Re: [racket-users] Retrieve name of defined variable in a syntax form in the expr of define form
At second thought I'll use syntax-local-name to infer names to structs (in an immutable field and using prop:custom-write) Does not give me the variable in which an instance originally was defined, but that is less important . Not being able to spot the original definition of an instance in case of an error while using the instance later on, well that I can live with. Thanks again, Jos On Sat, 27 Feb 2021 at 20:56, Matthew Flatt wrote: > >> If you're just interested in the symbolic name "x", as opposed to the >> binding identifier, then see `syntax-local-name` or >> `syntax-local-infer-name`. >> >> If you want the binding identifier, though, that's not available. >> >> Matthew >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL6KNi3dTaSXcWvwA1UDWtq5mEbEP1-sp3-73sAG%2BOxx%3D0%3Djsg%40mail.gmail.com.
Re: [racket-users] Retrieve name of defined variable in a syntax form in the expr of define form
Thanks for your quick reply. Yes I want the binding identifier. Alas. Nevertheless I am happy with the separation between expansion time and run time. I have decided not to redefine define. Jos On Sat, 27 Feb 2021 at 20:56, Matthew Flatt wrote: > If you're just interested in the symbolic name "x", as opposed to the > binding identifier, then see `syntax-local-name` or > `syntax-local-infer-name`. > > If you want the binding identifier, though, that's not available. > > Matthew > > At Sat, 27 Feb 2021 20:52:23 +0100, Jos Koot wrote: > > Hi > > > > Consider: > > (define-syntax (my-syntax stx) blah ...) > > (define x (my-syntax blah ...) > > > > Is it possible for syntax my-syntax such as to know (at expansion time) > > that is used as the expr of variable x in the expression of the > definition? > > Probably this is possible by redefining syntax define, but can I do it > > without touching syntax define? > > Thanks, Jos > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL6KNi05xNFAYXExOx9kX3%3D5QWoy_CQVoBfWENxBvFPzoonj%2Bw%40mail.gmail.com.
Re: [racket-users] A dict? question
Exactly. `'e` is a reader macro that gets read as `(quote e)`. When it's already under a quote, the quoted quote is treated as a symbol: > (dict-ref '('yay) 'quote) '(yay) > (quote ((quote yay))) '('yay) > '((quote yay)) '('yay) > (dict-ref '((quote yay)) 'quote) '(yay) -- William J. Bowman On Sun, Feb 28, 2021 at 01:45:56AM +0200, Yury Bulka wrote: > Indeed, > > > (dict-keys '('yay)) > '(quote) > > (dict-values '('yay)) > '((yay)) > > (dict-ref '('yay) 'quote) > '(yay) > > So... this boils down to: > > > (equal? '('yay) '((quote yay))) > #t > > -- > Yury Bulka > https://mamot.fr/@setthemfree > #NotOnFacebook > > > > William J. Bowman writes: > > > try (dict-ref ‘(‘yay) ‘quote) > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/87k0qtf51n.fsf%40privacyrequired.com. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/YDraI2UWIH3ejIN3%40williamjbowman.com.
Re: [racket-users] A dict? question
Indeed, > (dict-keys '('yay)) '(quote) > (dict-values '('yay)) '((yay)) > (dict-ref '('yay) 'quote) '(yay) So... this boils down to: > (equal? '('yay) '((quote yay))) #t -- Yury Bulka https://mamot.fr/@setthemfree #NotOnFacebook William J. Bowman writes: > try (dict-ref ‘(‘yay) ‘quote) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/87k0qtf51n.fsf%40privacyrequired.com.
Re: [racket-users] A dict? question
try (dict-ref ‘(‘yay) ‘quote) -- Sent from my phoneamajig > On Feb 27, 2021, at 15:31, Yury Bulka wrote: > > Dear Racketeers, > > I have noticed something I don't understand: > >> (dict? '(yay)) > #f >> (dict? '('yay)) > #t >> (dict-ref '('yay) 'yay) > ; dict-ref: no value for key: 'yay in: '('yay) > > I'm puzzled - what makes '('yay) a dict compared to '(yay)? > > (Running Racket 7.8 on Linux). > > -- > Yury Bulka > https://mamot.fr/@setthemfree > #NotOnFacebook > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/87mtvpf5pa.fsf%40privacyrequired.com. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/B540457B-D95F-4C18-A978-90033951BA0C%40williamjbowman.com.
[racket-users] A dict? question
Dear Racketeers, I have noticed something I don't understand: > (dict? '(yay)) #f > (dict? '('yay)) #t > (dict-ref '('yay) 'yay) ; dict-ref: no value for key: 'yay in: '('yay) I'm puzzled - what makes '('yay) a dict compared to '(yay)? (Running Racket 7.8 on Linux). -- Yury Bulka https://mamot.fr/@setthemfree #NotOnFacebook -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/87mtvpf5pa.fsf%40privacyrequired.com.
Re: [racket-users] Retrieve name of defined variable in a syntax form in the expr of define form
If you're just interested in the symbolic name "x", as opposed to the binding identifier, then see `syntax-local-name` or `syntax-local-infer-name`. If you want the binding identifier, though, that's not available. Matthew At Sat, 27 Feb 2021 20:52:23 +0100, Jos Koot wrote: > Hi > > Consider: > (define-syntax (my-syntax stx) blah ...) > (define x (my-syntax blah ...) > > Is it possible for syntax my-syntax such as to know (at expansion time) > that is used as the expr of variable x in the expression of the definition? > Probably this is possible by redefining syntax define, but can I do it > without touching syntax define? > Thanks, Jos -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20210227125605.1b1%40sirmail.smtps.cs.utah.edu.
[racket-users] Retrieve name of defined variable in a syntax form in the expr of define form
Hi Consider: (define-syntax (my-syntax stx) blah ...) (define x (my-syntax blah ...) Is it possible for syntax my-syntax such as to know (at expansion time) that is used as the expr of variable x in the expression of the definition? Probably this is possible by redefining syntax define, but can I do it without touching syntax define? Thanks, Jos -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAL6KNi36QCX%3D6x4hZk6wnfN7-n57a3MHq2jweVgWwvQ757pYEw%40mail.gmail.com.