Carl Eastlund wrote:
> John,
>> Looks right to me. The define-match-expander form takes two
> expressions, both of which are evaluated immediately at phase 1
> (compile-time) to produce transformers. It's basically define-syntax
> for a different kind of binding. You are writing as if it were
> define-syntax-rule, where you just fill in a pattern. Replace your
> use of it with:
>> (define-match-expander my-cons
> (lambda (stx) (error 'dontcare "aagh!"))
> (syntax-rules () [(_ a b) (cons a b)]))
>> Then you'll probably get the behavior you expected.
>> --Carl
Gah! Apologies again for moving so slowly on this. I'll try to fix it
now. Two things:
1. If I uninstall Unlib and try:
planet install untyped unlib.plt 3 18
I get a heck of a lot of Scribble errors, but I don't get any failure
to compile. I'm using an older PLT...
$ mzscheme -v
Welcome to MzScheme v4.2.1.5 [3m], Copyright (c) 2004-2009 PLT
Scheme Inc.
2. If John's looking at define-match-expander, the culprit must be
this bit in match.ss in Unlib:
; (_ expr pattern ...)
(define-match-expander match:eq?
(syntax-rules ()
[(_ expr pattern ...)
(? (cut eq? <> expr) pattern ...)])
eq?)
; (_ expr pattern ...)
(define-match-expander match:equal?
(syntax-rules ()
[(_ expr pattern ...)
(? (cut equal? <> expr) pattern ...)])
equal?)
I guess the second argument should be a syntax transformer procedure.
The documentation seems to be ambiguous on this, although it's a
pretty dumb misunderstanding on my part.
-- Dave