
I’m running Ubuntu so I can’t help unfortunately. There is a #rash channel here that might be helpful though

@soegaard2 Could you be thinking of https://github.com/willghatch/rackterm\|rackterm?

Why don’t the teaching languages display the binding arrows in DrRacket? Is there a setting to turn that on?

they display them if you hit “check syntax”

Ah. Thank you @samth

@jjlammi has joined the channel

Thanks @greg!

How do I use the property prop:match-expander
when defining a struct
? This yields an unbound identifier
error:

(struct struct-test (a b)
#:property prop:match-expander
(lambda (stx)
(syntax-case stx ()
[(_ b)
#'(struct enum-value ((? (lambda (x) (eq? x 'test-value)) a) b))]
))
)

Evidently it’s defined for-syntax… so can someone show an example of applying it like above ^^^?

@dan.ml.901 The procedure needs to take 2 arguments, the first is the struct itself, and the second is the stx

(struct struct-test (a b)
#:property prop:match-expander
(lambda (this stx)
(syntax-case stx ()
[(_ b)
#'(struct enum-value ((? (lambda (x) (eq? x 'test-value)) (struct-test-a this)) b))]
))
)

does that run for you? My error is “prop:match-expander: unbound identifier in: prop:match-expander”

adding the argument doesn’t change the error. should I be requiring racket/match a certain way? I just have (require racket/match)
.

oh, (require (for-template racket/match))
seems to work

Thank-you! I’ll experiment with this and see how it goes :smile:

Ah this doesn’t work… if I match using pattern [(struct-test …)
it uses the built-in struct-id matcher… I’m not sure how to trigger the custom prop:match-expander
. Does it have to be required for-syntax
?

Yes, the expander has to be used at the syntax level.

Oh, you’re trying to put it on the struct type whose instances are the run-time values you’re matching against, but it needs to be on the struct type of the syntax transformer value which struct-test
is bound to. For instance, (begin-for-syntax (struct struct-test-transformer () #:property prop:match-expander <...>)) (define-syntax struct-test (struct-test-transformer))