haakonhr
2021-2-26 08:21:55

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


anything
2021-2-26 13:27:18

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


jhemann
2021-2-26 14:58:41

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


samth
2021-2-26 15:02:08

they display them if you hit “check syntax”


jhemann
2021-2-26 15:22:06

Ah. Thank you @samth


jjlammi
2021-2-26 16:19:24

@jjlammi has joined the channel


sorawee
2021-2-26 20:29:39

Thanks @greg!


dan.ml.901
2021-2-27 00:20:51

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


dan.ml.901
2021-2-27 00:20:54

(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))] )) )


dan.ml.901
2021-2-27 00:21:39

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


kellysmith12.21
2021-2-27 00:30:42

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


kellysmith12.21
2021-2-27 00:31:15

(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))] )) )


dan.ml.901
2021-2-27 00:31:39

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


dan.ml.901
2021-2-27 00:33:07

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


dan.ml.901
2021-2-27 00:33:43

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


kellysmith12.21
2021-2-27 00:41:18

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


dan.ml.901
2021-2-27 01:32:09

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?


kellysmith12.21
2021-2-27 01:34:05

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


rokitna
2021-2-27 04:09:27

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))