November 2010
Intermediate to advanced
504 pages
12h 45m
English
The loop and format commands are powerful and hacker-friendly. Though most of the functionality they offer is available elsewhere in the Lisp language, these highly specialized commands are worth learning if you like terse code. We’ll look at loop in this chapter. The next chapter covers format.
Any type of looping you would ever want to do inside a computer program can be accomplished with the loop macro. Here’s a simple example:
>(loop for ibelow 5sum i)10
This code adds together the natural numbers below 5, like this:
| 0 + 1 + 2 + 3 + 4 = 10 |
You can see that this loop command doesn’t work in the way a proper Lisp command should. First of all, it’s parenthetically challenged. Never before ...
Read now
Unlock full access