May 2018
Beginner to intermediate
290 pages
6h 43m
English
As simple as it seems, there are a few things to keep in mind about let. The first is that the names defined in a let are exactly that: defined inside the let. Technically, let relies on lexical scope. In plain English this means the bindings created by let only exist inside the code that makes up the let body.
You can’t, for example, do this:
| | ;; We can use title inside of the let. |
| | |
| | (let [title "Let's Pretend This Never Happened"] |
| | (println "The title is" title) |
| | (print-the-title)) |
| | |
| | ;; But now we're outside of the let. |
| | |
| | (defn print-the-title [] |
| | (println "The title is" title)) ; Boom! |
Since title is only defined inside of the let, this shouldn’t come as a surprise. After all, we started this trip ...
Read now
Unlock full access