Returns a list that is the result of executing a function with a list (or lists) supplied as arguments to the function
(mapcar functionlist1... listn)
Arguments
A function.
One or more lists. The number of lists must match the number of arguments required by function.
Return Values
A list.
Examples
Command: (setq a 10 b 20 c 30)
30
Command: (mapcar '1+ (list a b c))
(11 21 31)
mapcar returns a list of the results:
This is equivalent to the following series of expressions, except that(1+ a)
(1+ b)
(1+ c)
lambda function can specify an anonymous function to be performed by mapcar. This is useful when some of the function arguments are constant or are supplied by some other means. The following example, entered from the Visual LISP Console window, demonstrates the use of lambda with mapcar:
The_$ (mapcar '(lambda (x)
(+ x 3)
)
'(10 20 30)
)
(13 23 33)