3 ms·
Thank you for the explanation, very interesting, and makes me want to dive more into lisp and see what's possible with this approach. Next thing you know, I am
by kirillzubovsky 6y ago
Thank you for the explanation, very interesting, and makes me want to dive more into lisp and see what's possible with this approach. Next thing you know, I am Clojure fanboy.
Can you help me understand, what is the purpose of (+ x 3) at the end of that let statement. Is that just the default return from the original function, using input given by the let function? Thanks!
- lispm 6y agoThe syntax of LET is let ({var | (var [init-form])}*) declaration* form*
- kazinator 6y agoAgain, if we say "let function" that is not accurate. let is an operator that creates a new nesting of the lexical scope in which it binds some variables, and then evaluates forms in that environment. let implements something similar to what is achieved with a combination of special syntax in some other languages. Lisp C (let ((x 1) { int x = 1; (y 2) int y = 2; (foo x y)) foo(x, y); } Both of these mean "create fresh instances of variables x and y, which are scoped only to this construct, initializing them with 1 and 2, and then call foo with x and y arguments."
- kirillzubovsky 6y agoGot it! Thanks.