Re: [racket-users] How do I provide a name as both a match expander and contracted function?

2019-12-31 Thread Eric Griffis
Hi Jack, It can be done with make-rename-transformer. (define (foo? obj) (equal? obj foo-impl)) > (define foo-widget list) > > (define/contract (foo-impl _) (-> number? symbol?) 'a-foo) > > (define-match-expander foo > (syntax-parser [(_ widget) #'(? foo? (app foo-widget widget))]) >

Re: [racket-users] How do I provide a name as both a match expander and contracted function?

2019-12-30 Thread Sorawee Porncharoenwase
IIUC, this is what Alex Knauth did in https://github.com/mbutterick/txexpr/pull/8. On Mon, Dec 30, 2019 at 7:07 PM Jack Firth wrote: > If I'm making my own data types, one common thing I want to do is make > smart constructors that double as match expanders. I could use >