I would like to do:
(mapcar #'assoc '(a s) '((a . b) (c . d) (s . f)))
and have it return
((A . B) (S . F))
Which seems pretty reasonable, considering (assoc 'a '((a . b) (c . d) (s . f)))
returns (A . B)
and (assoc 's '((a . b) (c . d) (s . f)))
returns (S . F)
. But alas it does not work:
*** - ASSOC: A is not a list
The following restarts are available:
ABORT :R1 Abort main loop
Any thoughts?
When used with two lists,
mapcar
applies the function pair-wise to the lists (and with three lists it applies them triple-wise etc.). Sois the same as
(when used with lists of different length,
mapcar
uses the size of the smallest list). To get what you want, you should do: