Answer the question
In order to leave comments, you need to log in
Can you explain lambda in lisp?
I'm starting to understand Lisp a little (I want to attach one thing to emacs). And I don't understand the tutorial:
...
(let* ( (...)
(lines (...) )
)
(insert
(mapconcat '(lambda (s) (concat "<key>" s ) )
lines ;; как передается переменная, которая ниже в параметр lambda?
"\n"
) )
Answer the question
In order to leave comments, you need to log in
The mapconcat function calls the function passed in the first argument (lambda in your case) for each element of the sequence passed in the second argument, and the returned values are glued into one line, separated by the third argument.
(mapconcat
'(lambda (s) (concat "<key>" s ))
lines
"\n")
lines
it contains '("a" "b" "c")
, then first the string "a" will be passed to the lambda, there it will be glued with the string "<key>", then the string "b", then "c", and after the received strings "<key>a", "<key>b" and "<key>c" will be concatenated into one string "<key>a\n<key>b\n<key>c".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question