How to concatenate simple-arrays and keep the element-type '(unsigned-bytes 8) in Common Lisp?
arrays, common-lisp, concatenation, lisp
Solution
As Rainer Joswig points out in the comments, you could simply specify the element type of your result vector:
(concatenate '(vector (unsigned-byte 8)) array-A array-B)
Note that the documentation says:
If the result-type is a subtype of vector, then if the implementation can determine the element type specified for the result-type, the element type of the resulting array is the result of upgrading that element type.
Therefore, your LISP implementation is free to choose a "better" element type for the result vector (this might happen if you specify something like `(unsigned-byte 5)`, for instance).
Problem
I got two simple-arrays, of which element-type is '(unsigned-byte 8). If I use `(concatenate 'vector array-A array-B)`, the result array's element-type won't be '(unsigned-byte 8) anymore. How can I concatenate arrays and keep their element-type in Lisp?