On Sun, Feb 04, 2007 at 04:10:55PM -0500, Elliot Cuzzillo wrote: > Coming from CL, I'm used to having macro definitions use > destructuring-bind in their argument lists, so that if we have > (defmacro blah ((x y) z) ...) then if you call (blah (fee fi) fo) then > x => fee, y => fi, and z=> fo. > Does this exist in Chicken's macros, or elsewhere in Chicken?
You can do this with the 'match' macro: http://galinha.ucpel.tche.br:8080//Pattern%20matching #;1> (define-macro (foo . bar) (match bar (() 0) ((x) x) (else "sorry"))) #;2> (foo) 0 #;3> (foo "x") "x" #;4> (foo "x" "y") "sorry" #;5> HTH, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth
pgp8Gj7ImQhxq.pgp
Description: PGP signature
_______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
