Hi all,

This is probably something really obvious, but I just can't
work it out.

I borrowed (and adapted) the example from the Common Lisp Hyperspec
(http://www.lisp.org/HyperSpec/Body/fun_macroexpa_acroexpand-1.html),
as I couldn't seem to google up an example of macroexpand-1 in any
Scheme, let alone Chicken:

-------------------------- chicken session ---------------------------
CHICKEN
Version 3.0.0 - linux-unix-gnu-x86      [ manyargs dload ptables applyhook ]
(c)2000-2008 Felix L. Winkelmann        compiled 2008-02-17 on tweek (Linux)

#;1> (use syntax-case)
; loading /usr/local/lib/chicken/3/syntax-case.so ...
; loading /usr/local/lib/chicken/3/syntax-case-chicken-macros.scm ...
#;2> (define-macro (alpha x y) `(beta ,y ,x))
#;3> (macroexpand '(alpha 1 2))
(beta (quote 2) (quote 1))
#;4> (macroexpand-1 '(alpha 1 2))
(alpha 1 2)
#f
#;5>
-------------------------- chicken session ---------------------------

Can anyone suggest why macroexpand-1 doesn't seem to expand the macro
at all? Have I fundamentally misunderstood something?


As far as I understand it, macroexpand should expand the (macro)
expression all the way to a completely non-macro expression. And that
seems to work correctly.

I also thought macroexpand-1 should just expand macros once (eg. one
level of expansion, which in this case should produce the same output
as macroexpand) - and that *doesn't* seem to be working.


Any explanations much appreciated, thank you.

Pete.
-- 
All programmers are optimists.  Perhaps this modern sorcery especially attracts
those who believe in happy endings and fairy godmothers.  Perhaps the hundreds
of nitty frustrations drive away all but those who habitually focus on the end
goal.  Perhaps it is merely that computers are young, programmers are younger,
and the young are always optimists.  But however the selection process works,
the result is indisputable:  "This time it will surely run," or "I just found
the last bug."   -- Frederick Brooks, "The Mythical Man Month"


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to