@@ -409,50 +409,6 @@ This is *not* valid:
409409
410410The error message is clear. At the time of reading ` (square (* a a)) ` , ` a ` is unknown.
411411
412-
413- ### When you don't use defined variables
414-
415- Read your compiler's warnings :)
416-
417- Below, it tells us that ` b ` is defined but never used. SBCL is pretty
418- good at giving us useful warnings at * compile time* (every time you
419- hit ` C-c C-c ` , ` C-c C-k ` or use ` load ` ).
420-
421- ~~~ lisp
422- (let (a b square)
423- (list a square))
424- ;; =>
425- ; caught STYLE-WARNING:
426- ; The variable B is defined but never used.
427- ~~~
428-
429- This example works in the REPL because SBCL's REPL always compiles expressions.
430-
431- This may vary with your implementation.
432-
433- It's great to catch typos!
434-
435- ``` lisp
436- (let* ((a 2)
437- (square (* a a)))
438- (list a squale))
439- ;; ^^^ typo
440- ```
441-
442- If you compile this in a .lisp file (or in a ` M-x slime-scratch ` ), you
443- will have two warnings, and your editor will underline each in two
444- different colors:
445-
446- ![ ] ( assets/let-example-squale.png " A decent editor highlights compilation warnings. ")
447-
448- - first, "square" is defined but unused
449- - second, "squale" is an undefined variable.
450-
451- If you run the snippet in the REPL, you will get the two warnings but
452- because the snippet is run, you will get the interactive debugger with
453- the "The variable SQUALE is unbound" error.
454-
455-
456412### setf inside let
457413
458414Let's make it even clearer: you can ` setf ` any value that is
@@ -494,6 +450,49 @@ we setf a dynamic parameter that was shadowed by a let binding:
494450```
495451
496452
453+ ### When you don't use defined variables
454+
455+ Read your compiler's warnings :)
456+
457+ Below, it tells us that ` b ` is defined but never used. SBCL is pretty
458+ good at giving us useful warnings at * compile time* (every time you
459+ hit ` C-c C-c ` , ` C-c C-k ` or use ` load ` ).
460+
461+ ~~~ lisp
462+ (let (a b square)
463+ (list a square))
464+ ;; =>
465+ ; caught STYLE-WARNING:
466+ ; The variable B is defined but never used.
467+ ~~~
468+
469+ This example works in the REPL because SBCL's REPL always compiles expressions.
470+
471+ This may vary with your implementation.
472+
473+ It's great to catch typos!
474+
475+ ``` lisp
476+ (let* ((a 2)
477+ (square (* a a)))
478+ (list a squale))
479+ ;; ^^^ typo
480+ ```
481+
482+ If you compile this in a .lisp file (or in a ` M-x slime-scratch ` ), you
483+ will have two warnings, and your editor will underline each in two
484+ different colors:
485+
486+ ![ ] ( assets/let-example-squale.png " A decent editor highlights compilation warnings. ")
487+
488+ - first, "square" is defined but never used
489+ - second, "squale" is an undefined variable.
490+
491+ If you run the snippet in the REPL, you will get the two warnings but
492+ because the snippet is run, and you will see the interactive debugger
493+ with the error "The variable SQUALE is unbound".
494+
495+
497496## Unbound variables
498497
499498"unbound" variables were not bound to anything, not even nil. Their
0 commit comments