Control Sequences for Printing Lisp Values
Any Lisp value can be printed with the print
or prin1
command. To print a value for humans, without any delimiters, we can use the princ
command:
>(prin1 "foo")
"foo" >(princ "foo")
foo
We can use the ˜s
and ˜a
control sequences with format
to produce the same behavior as prin1
and princ
. When used with format
, the ˜s
control sequence includes appropriate delimiters. The ˜a
shows the value, without delimiters, for humans to read:
>(format t "I am printing ˜s in the middle of this sentence." "foo")
I am printing "foo" in the middle of this sentence. >(format t "I am printing ˜a in the middle of this sentence." "foo")
I am printing foo in the middle of this sentence.
We can adjust the behavior of these ...
Get Land of Lisp now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.