mapc
mapc(u_funcl_arg1[l_arg2... ] ) =>l_arg1
Description
Applies a function to successive elements of the argument lists and returns the first argument list. All of the lists should have the same length. mapc returns l_arg1.
mapc is primarily used with a u_func that has side effects, because the values returned by the u_func are not preserved. u_func must be an object acceptable as the first argument to apply and it must accept as many arguments as there are lists. It is first passed the car of all the lists given as arguments. The elements are passed in the order in which the lists are specified. The second elements are passed to u_func, and so on until the last element.
Arguments
|
Additional argument lists, which must be the same length as l_arg1. |
Value Returned
Examples
Prints three lists as a side effect and returns the list (1 2 3).
mapc( 'list '(1 2 3) '(9 8 7) ) => (1 2 3)
mapc( '(lambda (x y) (print (list x y))) '(1 2 3) '(9 8 7) )
(1 9) (2 8) (3 7)
=> (1 2 3)
Related Topics
Return to top