Skip to content

Instantly share code, notes, and snippets.

@snmsts
Created September 4, 2013 04:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snmsts/6432705 to your computer and use it in GitHub Desktop.
Save snmsts/6432705 to your computer and use it in GitHub Desktop.
generate "Hello World" without including any literal.
(defmacro def-print-string (name string)
`(defun ,name ()
(let ((one (count t'(t))))
(print
(coerce
(mapcar #'code-char
(list
,@(loop :for i :across string
:collect
`(+ ,@(loop :for j := (char-code i) :then (floor j #.(count t'(t t)))
:for to-collect := 'one :then `(ash ,to-collect one)
:until (zerop j)
:unless (zerop (mod j #.(count t'(t t))))
:collect to-collect)))))
'string)))))
(def-print-string hello-world "Hello World")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment