[plt-dev] define-match-expander <-> unlib.plt doesn't compile
On Fri, Nov 13, 2009 at 8:57 AM, Sam TH <samth at ccs.neu.edu> wrote:
> On Fri, Nov 13, 2009 at 4:19 AM, Dave Gurnell <d.j.gurnell at gmail.com> wrote:
>>
>> Hi all,
>>
>> I haven't managed to fix this in its entirety and I'm not sure how to go
>> about it correctly.
>>
>> The eq? match expander now looks like this:
>>
>> ; (_ expr pattern ...)
>> (define-match-expander match:eq?
>> (lambda (stx)
>> (syntax-case stx ()
>> [(_ expr pattern ...)
>> #'(? (cut eq? <> expr) pattern ...)]))
>> (lambda (stx)
>> (syntax-case stx ()
>> [_ #'eq?])))
>>
>> However, the second transformer procedure only works if eq? is in
>> application position. Looking at the docs, I assume I want to use
>> make-rename-transformer in some way but I can't work out how in this
>> context.
>
> Unfortunately, the result of `make-rename-transformer' isn't a
> procedure (Matthew, could this be changed?), so you can't use it here.
The (planet cce/scheme) package includes `redirect-transformer' for
this purpose. Just use (redirect-transformer #'eq?) and it will
produce a transformer procedure that does the right work.
--Carl