Skip to content

Instantly share code, notes, and snippets.

@guicho271828
Last active December 22, 2015 08:59
Show Gist options
  • Save guicho271828/6448902 to your computer and use it in GitHub Desktop.
Save guicho271828/6448902 to your computer and use it in GitHub Desktop.
print Hello World without using any literals
; run with /usr/local/bin/sbcl --no-sysinit --no-userinit --script codeiq.lisp
(defun read-and-print-until-eof (stream char)
(declare (ignore char))
(let ((c (read-char stream nil nil)))
(if c
(progn (write-char c)
(read-and-print-until-eof stream char))
(sb-ext:exit))))
(set-macro-character #\; #'read-and-print-until-eof)
; Hello World
; run with /usr/local/bin/sbcl --no-sysinit --no-userinit --script codeiq2.lisp
(defun read-brainfuck-like-comments (stream char)
(declare (ignore char))
(labels ((count-whitespace (acc)
(let ((c (read-char stream nil nil)))
(if c
(if (graphic-char-p c)
(count-whitespace (1+ acc))
(write-char (code-char acc)))
(sb-ext:exit)))))
(count-whitespace 0)))
(set-macro-character #\; #'read-brainfuck-like-comments)
;
;
;
;
;
;
;
;
;
;
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment