May 2018
Beginner to intermediate
290 pages
6h 43m
English
Going from the simple-minded idea of functions as something you write and call manually to the functions as values idea has some interesting implications. Chief among these is that you don’t always know the exact context in which your function will be called. Since functions are values, they can get passed around and evaluated any number of times:
| | (defn execute-that-function-three-times [your-function] |
| | (your-function) |
| | (your-function) |
| | (your-function)) |
Or they might get called sometime later. For example, we might use Thread/sleep to wait 372 milliseconds before calling your function:
| | (defn execute-that-function-later [your-function] |
| | (Thread/sleep 372) ; Pause for 372 ms. |
| | (your-function)) |
Or it might never ...
Read now
Unlock full access