Last active
December 22, 2015 08:59
-
-
Save guicho271828/6448902 to your computer and use it in GitHub Desktop.
print Hello World without using any literals
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
; 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 |
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
; 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