Simple saves
nil
->()
and
->if
(if it has 2 arguments)(loop for...
->(loop as...
(concatenate'string a b)
->(format()"~a~a"a b)
- Large numbers can be compacted by writing them in base 36 with the prefix
#36r
. - Other tips (all of these apply to Common Lisp): Tips for golfing in Lisp
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
Reference
- 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.