Alkemet News

lispm

2 years ago |

parent
Programming languages may let you define variables by assigning them. But the scope can differ across languages.

Common Lisp requires one to clearly define the scope. PROGN does not create a scope.

> Why does LET even exist as an alternative to LET*? Why does Lisp even bother making this distinction?

Because there is a scope difference.

One can always do

    (let (a b c)
      (setf a 10)
      ...
      (setf b 20)
      ...
      (setf c (+ a b)
      ...)
Think of

     (let* ((a 10) (b 20) (c (+ a b)))
        ...)
as a short form for

     ((lambda (a b)
        ((lambda (c)
           ...)
         (+ a b)))
      10 20)