[ prog / sol / mona ]

prog


cddr

22 2024-08-20 04:01

>>21
LET wasn't immediately invented, and if you read sufficiently old lisp code

(let ((b 2) (c 3))
  (sqrt (+ (expt b 2) (expt c 2))))

would be written as

((LAMBDA (B C)
  (SQRT (+ (EXPT B 2) (EXPT C 2))))
 2 3)

they called it "lambda-binding"

lisp news for may 25, 1978 says that several standard macros have been added, LET is one of them. and explicitly defines LET as

        (LET ((V1 E1) (V2 E2) . . . (VN EN)) F1 F2 . . . FK)  
           ==>
            ((LAMBDA (V1 V2 . . . VN)
                     F1 F2 . . . FK)
                E1 E2 . . . EN)

and then sept 17, 1978,

[1] New autoloadable interpreter macros: backquote ("`") and LET.
    The "backquote" macro and the LET macro will be autoloaded when used.  
...
        The LET macro provides a convenient way to lambda-bind variables to 
    values.  Its usages is as follows:
        (LET ((var1 val1) (var2 val2) . . . (varn valn))
             <form1>
             . . . 
             <formn>)
    One may substitute merely "var"  in place of "(var NIL)"
    For example:
        (LET ((A 1) (B 2) C)
             <forms>)
    Binds A to 1, B to 2, and C to NIL and then evaluates <forms>.
29


VIP:

do not edit these