mapcon
mapcon(u_funcl_arg1[l_arg2] ) =>l_result
Description
Applies the function u_func to successive sublists of the lists and returns a concatenated list.
Arguments
Value Returned
|
Returns a concatenated list that results from calling the u_func on the cons cells of the given list |
Examples
mapcon((lambda (x)
(printf "x = %L\n" x)
(list (car x) (add1 (car x)))) '(1 2 3 4)); lambda: (u_func) with one argument
x = (1 2 3 4)
x = (2 3 4)
x = (3 4)
x = (4)
result: (1 2 2 3 3 4 4 5)
mapcon((lambda (x y) (printf "x = %L y = %L\n" x y)
(list (car x) (add1 (car y))))
'(1 2 3 4)
'(4 3 2 1)
) ; lambda: (u_func) is with 2 arguments
x = (1 2 3 4) y = (4 3 2 1)
x = (2 3 4) y = (3 2 1)
x = (3 4) y = (2 1)
x = (4) y = (1)
result : (1 5 2 4 3 3 4 2)
Related Topics
Return to top