mapcar
mapcar(u_funcl_arg1[l_arg2... ] ) =>l_result
Description
Applies a function to successive elements of the argument lists and returns the list of the corresponding results.
The values returned from successive calls to u_func are put into a list using the list function. If the argument lists are of different lengths, the mapcar function iterates till the end of the shortest list.
Arguments
|
Function to be applied to argument lists. The result of each call to u_func can be of any data type. |
|
Value Returned
|
A list of results from applying u_func to successive elements of the argument list. |
Examples
mapcar( 'plus '(1 2 3) '(9 8 7) )
=> (10 10 10)
mapcar( 'plus '(1 2 3 4) '(4 5) '(1 2 3 4 5 6) '(1 2 3))
=> (7 11)
mapcar( 'list '(a b c) '(1 2 3) '(x y z) )
=> ((a 1 x) (b 2 y) (c 3 z))
mapcar( lambda( (x) plus( x 1 )) '(2 4 6) )
=> (3 5 7)
Related Topics
Return to top