All pastes #2122744 Raw Edit

Anonymous

public text v1 · immutable
#2122744 ·published 2012-02-29 06:20 UTC
rendered paste body
(mapcar #'(lambda ( x y z) (list x z))
'(lambda (a b) (cons a b))
'(1 2 3)
'(list quote z))

mapcar: choose the first element in each list and call the function "#......"
The mapcar will stop as there is no more element in the list to execute. 
It will also stop when there is uneven element. 
For example '(1 2 3) '(4 5). It will execute for (1 4) and (2 5), but not (3), since its uneven.

PS:
forgot to add one thing about mapcar, once its taking out and executed, the element is out of the list
so the next first element is the second element on the list
so in this case function is (lambda (x y z) (list x z))



The list is (lambda (a b) (cons a b)), (1 2 3), (list quote z). total 3 list.

It will choose the element of each list and call the function to execute it.

Since the function is lambda...
lambda is a nameless function like you said, and (x y z) is the parameter, (list x z) is the function.
so there is 3 variable in the parameter, it takes 3 argument. 



The function is this... (lambda (x y z) (list x z))

the first time it execute will take out "lambda" "1" "list" from each list
so it look like  
(lambda ('lambda '1 'list) (list 'lambda 'list))
so it becomes (lambda list)


the second time it execute will take out "(a b)" "2" "quote" from each list
(lambda ('(a b) '2 'quote) (list '(a b) 'quote))
so it becomes ((a b) quote)


the third time it execute will take out "(cons a b)" "3" "z" from each list
(lambda ('(cons a b) '3 'z) (list '(cons a b) 'z))
so it becomes ((cons a b) z)


Since it will return a big list, back it would be ((lambda list) ((a b) quote) ((cons a b) z))