[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How can you do things like ?X -> (*var* x) without Read Macros ?
(1) if you are implementing your own read/eval/print loop for a random
language you can write your own read, or use that CGOLREAD that
someone on this list may have already ported to scheme.
(1.5) you may be able to get away with a read/mung/eval/print loop.
Just mung the result of read before you pass it along.
I teach just this technique to transform ?x into the result of
(make-variable :name 'x) (common lisp, sigh...) in a problem
set on pattern matching and pattern compilation.
(2) If you have evaluation macros, you can always have them mung
the passed-in-structure without mercy, e.g. using the technique (1.5)
(assert (append ?x () ?x))
(assert (append ?x (?a . ?y) (?a . ?y))
(append ?x ?y ?y))
(3) If you dont have evaluation macros, big deal, just quote the arguments,
(assert '(append ?x () ?x))
as long as can call EVAL or COMPILE yourself there is no loss of
(4) In drastic situations use strings,
(fortran "FUNCTION F(X,Y)
F = X*Y+SIN(X)
Note that FORTRAN 77 uses 'FOO BAR' for strings, so this actually works
ok, without having to escape-quote internal double quotes.