We find that this function constructor implements composition in P. Graham "ANSI Common Lisp" (p. 110). The arguments are n> 0 quoted function names. I do not understand it completely, so I will give the code here and ask the following questions:
(defun compose (&rest fns) (destructuring-bind (fn1 . rest) (reverse fns)
The list of arguments for the layout is canceled and unpacked, its (now the first) element is bound to "fn1", and the rest is "rest". The body of the outermost lambda is the abbreviation: (funcall fi (funcall fi-1 ...)), with operands in inverted order to restore the original one.
1) What is the role of the external lambda expression? Namely, where does he get his โargumentsโ from? Is the data structure specified as the first argument to destructuring-bind? 2) Where the innermost lambda takes two of its arguments:
I mean, I can appreciate what the code does, but still the lexical domain is a bit of a mystery to me. Looking forward to any comments! Thanks in advance, // Marco
source share