November 2010
Intermediate to advanced
504 pages
12h 45m
English
Common Lisp has two different commands for starting a new line during printing. The first, terpri, simply tells Lisp to terminate the current line and start a new one for printing subsequent output. For example, we can print two numbers on different lines like so:
>(progn (princ 22)(terpri)(princ 33))22 33
We can also start a new line with fresh-line. This command will start a new line, but only if the cursor position in the REPL isn’t already at the very front of a line. Let’s look at some examples:
>(progn (princ 22)(fresh-line)(princ 33))22 33 >(progn (princ 22)(fresh-line)(fresh-line)(princ 33))22 33
As you can see, placing two fresh-line statements between the two princ calls resulted in Lisp printing ...
Read now
Unlock full access