lnostdal·17 years ago·discussquick and dirty; i'm not even sure it is correct:(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
lnostdal·18 years ago·discussm-x slime (starts slime and sbcl) c-x-2 (split window in two; one for coding one for REPL)..open a file at the top window by pressing c-x-f and typing in hello-world.lisp <enter>..yay, start coding..c-c-c to eval forms c-c-k to eval/compile the entire file q to close down "popups" (exceptions .. etc.)yawn .. what's the problem? .. are somewhat, "limited"?
(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