Created
September 4, 2013 04:17
-
-
Save snmsts/6432705 to your computer and use it in GitHub Desktop.
generate "Hello World" without including any literal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro def-print-string (name string) | |
`(defun ,name () | |
(let ((one (count t'(t)))) | |
(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