[Larceny-users] Probably not a bug in R6RS, but...
Felix Klock
felixluser at pnkfx.org
Mon Dec 15 10:22:42 EST 2008
David (cc'ing larceny-users)-
On Dec 15, 2008, at 5:57 AM, David Rush wrote:
> And yes, I didn't *really* mean to make #\space into a symbol that was
> equivalent to LAMBDA in the first place, but I still think that this
> half-functional situation is odd. It looks like maybe there is some
> interference with the lexer...
Yes, I concur that this is likely to be a lexing/parsing issue.
% ~/bin/larceny
Larceny v0.964+ "Fluoridation" (Aug 12 2008 22:00:42, precise:Posix
Unix:unified)
larceny.heap, built on Tue Aug 12 22:01:04 EDT 2008
> (define-syntax \ (syntax-rules () ((\ v e0 e+ ...) (lambda v e0 e
+ ...))))
\x20;
> (macro-expand '(\ v (apply + v)))
((lambda () (\x20;v (apply + v))))
> (macro-expand '(\ v (apply + v)))
((lambda ()
(lambda \x2e;v\x7c;1\x7c;2 (begin v (apply + v)))))
Funny stuff.
Oh, actually, I think I just figured out your problem: the macro
pattern (\ v e0 e+ ...) is treating the entirety of '\ v' as a single
token.
So if you like, you can try this instead:
% ~/bin/larceny
Larceny v0.964+ "Fluoridation" (Aug 12 2008 22:00:42, precise:Posix
Unix:unified)
larceny.heap, built on Tue Aug 12 22:01:04 EDT 2008
> (define-syntax \ (syntax-rules () ((\ v e0 e+ ...) (lambda v e0 e
+ ...))))
\x20;
> (\ (a b) (+ a b))
#<PROCEDURE>
> ((\ (a b) (+ a b)) 1 2)
3
Note that in the latter, I am carefully placing at least two spaces
after the '\' character.
(As for your question of whether it should be filed as a bug -- I
figure the worst that can happen is that we'll assign in a status like
"wontfix" or "notabug". I do ask though that if you do file it as a
bug, make sure to describe what the expected behavior should be -- the
only reason I have not filed a bug on this myself is that it is not
immediately obvious what behavior one should expect here -- the
current behavior may be entirely correct, and the problem is that your
macro was incorrectly written, as I describe above.)
-Felix
More information about the Larceny-users
mailing list