Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Is it possible to write c...r in lisp, for any combination of letters a and d?.
(defmacro blah (arg body) (with-input-from-string (stream (reverse (string arg))) (dolist (char (loop :for char = (read-char stream nil) :while (and char (or (char= char #\A) (char= char #\D) (error "BLAH: Only A or D is accepted."))) :collect char)) (case char (#\A (setf body `(car ,body))) (#\D (setf body `(cdr ,body))))) body))
CL-USER> (let ((data '((42)))) (blah aa data)) 42 CL-USER>
..manipulate the reader using read-macros (see TCR's new named-readtables library) if you want anything fancier. check out this btw.; http://groups.google.com/group/comp.lang.lisp/msg/d2425c92ce...
edit: the web still doesn't work as i want it to work .. i'm not going to bother fixing the whitespace etc. here
There are no comments on this comment yet.
(defmacro blah (arg body) (with-input-from-string (stream (reverse (string arg))) (dolist (char (loop :for char = (read-char stream nil) :while (and char (or (char= char #\A) (char= char #\D) (error "BLAH: Only A or D is accepted."))) :collect char)) (case char (#\A (setf body `(car ,body))) (#\D (setf body `(cdr ,body))))) body))
CL-USER> (let ((data '((42)))) (blah aa data)) 42 CL-USER>
..manipulate the reader using read-macros (see TCR's new named-readtables library) if you want anything fancier. check out this btw.; http://groups.google.com/group/comp.lang.lisp/msg/d2425c92ce...
edit: the web still doesn't work as i want it to work .. i'm not going to bother fixing the whitespace etc. here