Earlier quoted context omitted.
reading and reducing a list: CL-USER 109 > (reduce #'+ (read)) (1 2 3) 6 reading and reducing a vector: CL-USER 110 > (reduce #'+ (read)) #(1 2 3) 6 I've changed only the opening bracket.
Did you change from map to reduce because map needs to be told what kind of sequence to create? In Clojure the literal syntax avoids that. In addition there is this caveat about the literal vector syntax in Common Lisp: You can use the #(...) syntax to include literal vectors in your code, but as the effects of modifying literal objects aren't defined, you should always use VECTOR or the more general function MAKE-AR…
CL-USER 111 > (defun maps (function sequence)
(map (type-of sequence) function sequence))
MAPS
CL-USER 112 > (maps #'1+ '(1 2 3))
(2 3 4)
CL-USER 113 > (maps #'1+ #(1 2 3))
#(2 3 4)
I can also write a compiler macro, so that the implementation is chosen at compile time, when a literal data object is used... stuff which a Common Lisp implementation already might do for MAP.Common Lisp chose to define the basic MAP to always specify the result sequence I want to create or NIL for no sequence.
> You can use the #(...) syntax to include literal vectors in your code, but as the effects of modifying literal objects aren't defined, you should always use VECTOR or the more general function MAKE-ARRAY to create vectors you plan to modify.
That's not different for lists and vectors. For both I need to know which I want to modify. Common Lisp has generic operations to create and copy sequences for that: I can call COPY-SEQ to copy the literal sequence or call MAKE-SEQUENCE to create the sequence type I want.
Here (and in many other places) Common Lisp is a low-level language, which exposes these things to the programmer.