General
()
is a shorter way of writingnil
.- To concatenate two strings,
(format()"~a~a"a b)
is shorter than(concatenate'string a b)
. for
can be replaced withas
, saving a byte.- Large numbers can be compacted by writing them in base 36 with the prefix
#36r
. - Tips for golfing in Lisp
- The Common Lisp Hyper-Spec has a useful alphabetical list of functions.
- The Implementation Notes for GNU CLISP have information specific to the version of Lisp used on code.golf.
Using quote
as a variable
Sometimes, it is helpful to use quote
as a variable, since 'foo
is short for (quote foo)
. To use quote
in an expression, use dotted pair notation.
; Example:
(dotimes(i 10)(format t"~d ~a~%"i"potato")) ; this
(dotimes'10(format t"~d ~a~%".'"potato")) ; is equivalent to this