Name: Anonymous 2010-02-20 8:39
Do I need to learn functional programming and LISP ()())())))))))))))))))))))) to be an EXPERT DEVELOPER ?
(defconstant +magic-keyword+ "Sunn O")
(defconstant +magic-keyword-char+ (aref +magic-keyword+ 0))
(defconstant +magic-keyword-rest+ (subseq +magic-keyword+ 1))
;; this is actually not perfect, but should be enough for this hack
(defvar *original-readtable*)
(defun read-string (stream length)
(let ((string (make-string length)))
(read-sequence string stream :end length)
string))
(defun SunnO-reader (stream char)
(assert (char= char +magic-keyword-char+))
(let ((string (read-string stream (length +magic-keyword-rest+))))
(let ((*readtable* *original-readtable*))
(read
(make-concatenated-stream
(make-string-input-stream
(if (string= string +magic-keyword-rest+) "((("
(concatenate 'string (string +magic-keyword-char+) string)))
stream)
t nil t))))
(eval-when (:compile-toplevel :load-toplevel :execute)
(setq *original-readtable* (copy-readtable))
(set-macro-character #\S #'SunnO-reader))
;CL-USER> 'Sunn O this is stupid and useless but at least it's a half-clever hack)))
;(((THIS IS STUPID AND USELESS BUT AT LEAST IT 'S A HALF-CLEVER HACK)))
;CL-USER> (STRING 'sup-/prog/)
;"SUP-/PROG/"
;^ shows that other strings starting with S are not affected