[pro] The Best Examples of "Code is Data"
Faré
fahree at gmail.com
Mon Sep 6 17:31:47 UTC 2010
My favorite macro was suggested by Marco Baringer:
(defmacro with-nesting ((#-ccl &optional) &rest things)
(reduce #'(lambda (outer inner) (append outer (list inner)))
things :from-end t))
You can then put plenty of binding forms at the same indentation level,
without inventing one kind of new syntax per binding form.
I once wrote a program to turn SEXP-syntaxed IBM 370 assembly
"datastructure" declarations into Lisp code to decode such. Worked
great, but doesn't fit in a page, what with EBCDIC decoding, weird
assembly conventions, primitive memory management and other horrors.
But the principle was also that inside a PROGX, a definition form
(DS PRS H ->date date-string "PARS Date of update") ;@@drop
would turn into code that would bind a variable PRS to a value read
from current cursor position (post-incremented),
interpreted as a date, and add a summary of said value (a string) to an index.
You could then read a reformatted, annotated, tweaked and bugfixed
derivative of the original assembly source code as the program to
decode same datastructures.
[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
The best place to find a helping hand is at the end of your own arm.
More information about the pro
mailing list