Last active
December 22, 2015 06:58
-
-
Save stibear/6434691 to your computer and use it in GitHub Desktop.
generate "Hello World" without including any literal.
This file contains 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) | |
`(defun ,name () | |
(let ((one (count t'(t)))) | |
(coerce | |
(mapcar #'code-char | |
(list | |
,@(loop :for i :across (string name) | |
: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|) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment