Re: [racket-users] Re: Open source projects
There is also a suggested projects page on the wiki https://github.com/racket/racket/wiki/Intro-Projects I don’t know if it is still accurate. Kind regards, Stephen On Fri, 20 Oct 2017 at 06:45, Jack Firth wrote: > Welcome, we're very glad to have you! > > Open source Racket projects are scattered all over the place, but here are > some good ways to find actively maintained and hopefully accessible > projects that might interest you: > > - Watch some talks from recent RacketCons, especially the most recent one > (which, conveniently, was barely a week and a half ago). A lot of talks are > on interesting and wildly unusual open source projects, and as a bonus most > presenters give out their contact information so people can reach out if > they have questions or might be interested in contributing. You can find > information on the most recent RacketCon at con.racket-lang.org including > video and livestream recordings, talk descriptions, and slides for each > talk. Info for previous RacketCons are available at > con.racket-lang.org/2016/, con.racket-lang.org/2015/, etc. Alas we don't > yet have individual prettily-edited videos for each talk at RacketCon 2017; > they're only viewable via the saved livestream on youtube. > - Search the official package catalog at pkgs.racket-lang.org for > packages whose descriptions sound interesting and which are hosted on > GitHub / GitLab / some other platform that makes it easy to contribute. > Every package includes links to its docs and repostiory, as well as a > contact email address for whoever maintains it. If you're not looking for a > package in a particular problem domain your best bet is probably to > restrict your search to only packages that build, have passing tests, and > have docs. Decent issue / todo lists in the project repo are a nice bonus. > - Browse around the front page of the online Racket documentation at > docs.racket-lang.org. The online docs includes all docs from all > successfully built user packages at pkgs.racket-lang.org, grouped into > top level categories. Once you find some docs for a project that's > interesting, it's (hopefully!) not difficult to find the package containing > those docs by searching pkgs.racket-lang.org. > - Hop in the Racket IRC (#racket on freenode) or the Racket Slack channel > (signup at racket-slack.herokuapp.com) and ask around about what people > are working on. I'm sure many folks will be delighted to talk about their > projects. And this mailing list isn't a bad place to ask either. > - If you want to try something more ambitious, you can take a peek at the > Github repos in the "racket" organization (https://github.com/racket). > These are all (or mostly? not sure) packages in the "main distribution", > meaning they ship directly with Racket and don't have to be installed by > users. Contributing to these packages can be a little trickier because > sometimes they depend on the latest version of Racket's core, meaning > you'll have to compile Racket's core from source. > > Also, all throughout this month Github and DigitalOcean are hosting an > online event called Hacktoberfest. By signing up at > https://hacktoberfest.digitalocean.com/ you'll get a free tshirt mailed > to you if you submit four or more pull requests to any public repositories > on Github before October ends. It doesn't matter how large each pull > request is and a pull request to your own repo counts. And speaking from > experience, they're very comfortable shirts. > >> -- > 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. > For more options, visit https://groups.google.com/d/optout. > -- Kind regards, Stephen -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: European Racketeers and conferences
On 25/08/17 01:51, Greg Hendershott wrote: > Crazy idea: RacketCon 2018 in Reykjavik Iceland. > > Relatively neutral travel distance from Europe and (at least Eastern > half of) US. > > (IIUC September would be more affordable than August, and less rainy > than October.) > Great idea, would love to join the RacketCon and visit Iceland! :) -- Paulo Matos -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] European Racketeers and conferences
Perfect! Just added myself. Shame not more people in Europe though. :) On 17/10/17 19:15, Ben Greenman wrote: > I just changed the map settings so anyone can edit it. > > If you'd like to add your city to the map: > > 1. Look for "racketeers.csv" in the menu > 2. Click the "vertical dots" to the right of "racketeers.csv". (If you > hover the mouse over these dots, it should say "Layer Options") > 3. Click "Open Data Table" > 4. Right-click any row, choose "Add Row" > 5. Add yourself, hit enter > > Here's the link again: > https://drive.google.com/open?id=1i3zN11e_6te5ytduAiv1cidrIi4&usp=sharing > -- Paulo Matos -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Open source projects
That page is pretty out of date. This list is more focused on contributing to Racket itself, but is more up to date. It was compiled for the "office hours" portion of the last RacketCon, ~2 weeks ago. https://github.com/racket/racket/wiki/Racketeer-Office-Hours-2017-Task-Ideas Vincent On Fri, 20 Oct 2017 05:14:28 -0500, Stephen De Gabrielle wrote: > > There is also a suggested projects page on the wiki > > https://github.com/racket/racket/wiki/Intro-Projects > > I don’t know if it is still accurate. > > Kind regards, > > Stephen > > On Fri, 20 Oct 2017 at 06:45, Jack Firth wrote: > > Welcome, we're very glad to have you! > > Open source Racket projects are scattered all over the place, but here are > some good ways to find actively maintained and hopefully accessible projects > that might interest you: > > - Watch some talks from recent RacketCons, especially the most recent one > (which, conveniently, was barely a week and a half ago). A lot of talks are > on interesting and wildly unusual open source projects, and as a bonus most > presenters > give out their contact information so people can reach out if they have > questions or might be interested in contributing. You can find information on > the most recent RacketCon at con.racket-lang.org including video and > livestream recordings, > talk descriptions, and slides for each talk. Info for previous RacketCons > are available at con.racket-lang.org/2016/, con.racket-lang.org/2015/, etc. > Alas we don't yet have individual prettily-edited videos for each talk at > RacketCon 2017; they're > only viewable via the saved livestream on youtube. > - Search the official package catalog at pkgs.racket-lang.org for packages > whose descriptions sound interesting and which are hosted on GitHub / GitLab > / some other platform that makes it easy to contribute. Every package > includes links to its > docs and repostiory, as well as a contact email address for whoever > maintains it. If you're not looking for a package in a particular problem > domain your best bet is probably to restrict your search to only packages > that build, have passing tests, > and have docs. Decent issue / todo lists in the project repo are a nice > bonus. > - Browse around the front page of the online Racket documentation at > docs.racket-lang.org. The online docs includes all docs from all successfully > built user packages at pkgs.racket-lang.org, grouped into top level > categories. Once you find > some docs for a project that's interesting, it's (hopefully!) not difficult > to find the package containing those docs by searching pkgs.racket-lang.org. > - Hop in the Racket IRC (#racket on freenode) or the Racket Slack channel > (signup at racket-slack.herokuapp.com) and ask around about what people are > working on. I'm sure many folks will be delighted to talk about their > projects. And this > mailing list isn't a bad place to ask either. > - If you want to try something more ambitious, you can take a peek at the > Github repos in the "racket" organization (https://github.com/racket). These > are all (or mostly? not sure) packages in the "main distribution", meaning > they ship directly with > Racket and don't have to be installed by users. Contributing to these > packages can be a little trickier because sometimes they depend on the latest > version of Racket's core, meaning you'll have to compile Racket's core from > source. > > Also, all throughout this month Github and DigitalOcean are hosting an > online event called Hacktoberfest. By signing up at > https://hacktoberfest.digitalocean.com/ you'll get a free tshirt mailed to > you if you submit four or more pull requests to any > public repositories on Github before October ends. It doesn't matter how > large each pull request is and a pull request to your own repo counts. And > speaking from experience, they're very comfortable shirts. > > -- > 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. > For more options, visit https://groups.google.com/d/optout. > > -- > Kind regards, > Stephen > -- > > -- > 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. > For more options, visit https://groups.google.com/d/optout. -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Open source projects
> On Oct 20, 2017, at 8:06 AM, Vincent St-Amour > wrote: > > That page is pretty out of date. > > This list is more focused on contributing to Racket itself, but is more > up to date. It was compiled for the "office hours" portion of the last > RacketCon, ~2 weeks ago. > > https://github.com/racket/racket/wiki/Racketeer-Office-Hours-2017-Task-Ideas There’s something that I now want, and I’m not sure which list to add it to. Following a discussion with William Hatch about shell usage in Racket, what I think I really want is auto-completion of filenames in DrRacket, probably using a pop-up. That is: I type a string containing a path fragment, and then I hit, say, C-c C-r or some other unused combination (ha!), and I get a dialog that will allow me with a small number of keystrokes to auto-complete to the filename that I’m looking for. Should be not-too-impossible. If I get a spare ten hours, I’d love to do it myself… Which list should I add this to? John cc: william hatch except I’m too busy to > > Vincent > > > On Fri, 20 Oct 2017 05:14:28 -0500, > Stephen De Gabrielle wrote: >> >> There is also a suggested projects page on the wiki >> >> https://github.com/racket/racket/wiki/Intro-Projects >> >> I don’t know if it is still accurate. >> >> Kind regards, >> >> Stephen >> >> On Fri, 20 Oct 2017 at 06:45, Jack Firth wrote: >> >> Welcome, we're very glad to have you! >> >> Open source Racket projects are scattered all over the place, but here are >> some good ways to find actively maintained and hopefully accessible projects >> that might interest you: >> >> - Watch some talks from recent RacketCons, especially the most recent one >> (which, conveniently, was barely a week and a half ago). A lot of talks are >> on interesting and wildly unusual open source projects, and as a bonus most >> presenters >> give out their contact information so people can reach out if they have >> questions or might be interested in contributing. You can find information >> on the most recent RacketCon at con.racket-lang.org including video and >> livestream recordings, >> talk descriptions, and slides for each talk. Info for previous RacketCons >> are available at con.racket-lang.org/2016/, con.racket-lang.org/2015/, etc. >> Alas we don't yet have individual prettily-edited videos for each talk at >> RacketCon 2017; they're >> only viewable via the saved livestream on youtube. >> - Search the official package catalog at pkgs.racket-lang.org for packages >> whose descriptions sound interesting and which are hosted on GitHub / GitLab >> / some other platform that makes it easy to contribute. Every package >> includes links to its >> docs and repostiory, as well as a contact email address for whoever >> maintains it. If you're not looking for a package in a particular problem >> domain your best bet is probably to restrict your search to only packages >> that build, have passing tests, >> and have docs. Decent issue / todo lists in the project repo are a nice >> bonus. >> - Browse around the front page of the online Racket documentation at >> docs.racket-lang.org. The online docs includes all docs from all >> successfully built user packages at pkgs.racket-lang.org, grouped into top >> level categories. Once you find >> some docs for a project that's interesting, it's (hopefully!) not difficult >> to find the package containing those docs by searching pkgs.racket-lang.org. >> - Hop in the Racket IRC (#racket on freenode) or the Racket Slack channel >> (signup at racket-slack.herokuapp.com) and ask around about what people are >> working on. I'm sure many folks will be delighted to talk about their >> projects. And this >> mailing list isn't a bad place to ask either. >> - If you want to try something more ambitious, you can take a peek at the >> Github repos in the "racket" organization (https://github.com/racket). These >> are all (or mostly? not sure) packages in the "main distribution", meaning >> they ship directly with >> Racket and don't have to be installed by users. Contributing to these >> packages can be a little trickier because sometimes they depend on the >> latest version of Racket's core, meaning you'll have to compile Racket's >> core from source. >> >> Also, all throughout this month Github and DigitalOcean are hosting an >> online event called Hacktoberfest. By signing up at >> https://hacktoberfest.digitalocean.com/ you'll get a free tshirt mailed to >> you if you submit four or more pull requests to any >> public repositories on Github before October ends. It doesn't matter how >> large each pull request is and a pull request to your own repo counts. And >> speaking from experience, they're very comfortable shirts. >> >> -- >> 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...@goog
Re: [racket-users] Open source projects
I think there's value to having a general projects list, beyond the office hours one. The older list was an attempt of that, which failed at that purpose by becoming more of a "brain dump" area, and falling into disrepair. I think that for such a list to succeed, it would need to be actively maintained and curated by someone. John, would you be willing to do it? Vincent On Fri, 20 Oct 2017 11:42:27 -0500, 'John Clements' via Racket Users wrote: > > > > On Oct 20, 2017, at 8:06 AM, Vincent St-Amour > > wrote: > > > > That page is pretty out of date. > > > > This list is more focused on contributing to Racket itself, but is more > > up to date. It was compiled for the "office hours" portion of the last > > RacketCon, ~2 weeks ago. > > > > > > https://github.com/racket/racket/wiki/Racketeer-Office-Hours-2017-Task-Ideas > > There’s something that I now want, and I’m not sure which list to add it to. > Following a discussion with William Hatch about shell usage in Racket, what I > think I really want is auto-completion of filenames in DrRacket, probably > using a pop-up. That is: I type a string containing a path fragment, and then > I hit, say, C-c C-r or some other unused combination (ha!), and I get a > dialog that will allow me with a small number of keystrokes to auto-complete > to the filename that I’m looking for. > > Should be not-too-impossible. > > If I get a spare ten hours, I’d love to do it myself… > > Which list should I add this to? > > John > > cc: william hatch except I’m too busy to > > > > > Vincent > > > > > > On Fri, 20 Oct 2017 05:14:28 -0500, > > Stephen De Gabrielle wrote: > >> > >> There is also a suggested projects page on the wiki > >> > >> https://github.com/racket/racket/wiki/Intro-Projects > >> > >> I don’t know if it is still accurate. > >> > >> Kind regards, > >> > >> Stephen > >> > >> On Fri, 20 Oct 2017 at 06:45, Jack Firth wrote: > >> > >> Welcome, we're very glad to have you! > >> > >> Open source Racket projects are scattered all over the place, but here are > >> some good ways to find actively maintained and hopefully accessible > >> projects that might interest you: > >> > >> - Watch some talks from recent RacketCons, especially the most recent one > >> (which, conveniently, was barely a week and a half ago). A lot of talks > >> are on interesting and wildly unusual open source projects, and as a bonus > >> most presenters > >> give out their contact information so people can reach out if they have > >> questions or might be interested in contributing. You can find information > >> on the most recent RacketCon at con.racket-lang.org including video and > >> livestream recordings, > >> talk descriptions, and slides for each talk. Info for previous RacketCons > >> are available at con.racket-lang.org/2016/, con.racket-lang.org/2015/, > >> etc. Alas we don't yet have individual prettily-edited videos for each > >> talk at RacketCon 2017; they're > >> only viewable via the saved livestream on youtube. > >> - Search the official package catalog at pkgs.racket-lang.org for packages > >> whose descriptions sound interesting and which are hosted on GitHub / > >> GitLab / some other platform that makes it easy to contribute. Every > >> package includes links to its > >> docs and repostiory, as well as a contact email address for whoever > >> maintains it. If you're not looking for a package in a particular problem > >> domain your best bet is probably to restrict your search to only packages > >> that build, have passing tests, > >> and have docs. Decent issue / todo lists in the project repo are a nice > >> bonus. > >> - Browse around the front page of the online Racket documentation at > >> docs.racket-lang.org. The online docs includes all docs from all > >> successfully built user packages at pkgs.racket-lang.org, grouped into top > >> level categories. Once you find > >> some docs for a project that's interesting, it's (hopefully!) not > >> difficult to find the package containing those docs by searching > >> pkgs.racket-lang.org. > >> - Hop in the Racket IRC (#racket on freenode) or the Racket Slack channel > >> (signup at racket-slack.herokuapp.com) and ask around about what people > >> are working on. I'm sure many folks will be delighted to talk about their > >> projects. And this > >> mailing list isn't a bad place to ask either. > >> - If you want to try something more ambitious, you can take a peek at the > >> Github repos in the "racket" organization (https://github.com/racket). > >> These are all (or mostly? not sure) packages in the "main distribution", > >> meaning they ship directly with > >> Racket and don't have to be installed by users. Contributing to these > >> packages can be a little trickier because sometimes they depend on the > >> latest version of Racket's core, meaning you'll have to compile Racket's > >> core from source. > >> > >> Also, all throughout this month Github and Dig
[racket-users] Macro confusion with syntax-parse
I'm working on a macro that I'd like to work similar to the 'big-bang' macro of 2htdp/universe with its various clauses, but something's going on that I don't understand. At the bottom of this email is some code for a very simple macro, 'calc', that is not what I'm working on, but exhibits the puzzling behavior. Here, I'm trying to have an expression like (calc (add 5 6) (add 10 9)) expand to a block of some other expressions. Just like the behavior of big-bang, I'd like to raise an error if (add ...) is used in a context other than as a clause of 'calc'. But I also don't want it to get confused with another definition of 'add' in the user code. With the code below, when run as is, it does what I want - the (calc ...) expressions - one a top-level expression and the one in (define A (calc ...)) both expand to a (quoted) s-expression (just for debugging purposes), namely: '(begin (printf "~a~n" (+ 4 5)) (printf "~a~n" (+ 9 10))) But, if you uncomment the last two lines, which introduces another definition of 'add', then the first expression still produces the same as above, but the expansion of the 'A' expression is just '(begin). It seems like the syntax-parse is no longer matching correctly against the (~literal add). Actually, 'big-bang' also suffers from this same problem -- if you do (big-bang 0 (on-tick ...)) as a top-level expression in a file with a definition of (define on-tick add1), it works fine. But if you put the 'big-bang' inside a define: (define X (big-bang 0 (on-tick ...))) and don't change anything else it complains about the on-tick "... keyword being used as a variable..." Why does this happen and is there a way to get around this problem -- i.e. have the behavior of the program below be exactly the same whether there is a 'define' around the macro use or not? Thanks very much for any insight! --- nadeem ;;; #lang racket (module calc racket (provide calc add) (require (for-syntax syntax/parse)) (define-for-syntax out-of-context (lambda (stx) (raise-syntax-error #f "used out of context" stx))) (define-syntax add out-of-context) (define-for-syntax (process-clauses clauses) (syntax-parse clauses [(((~literal add) x y) cs ...) #`((printf "~a~n" (+ x y )) #,@(process-clauses #'(cs ...) ))] [(c cs ...) (process-clauses #'(cs ...))] ; skip unexpected clauses for now [_ #'()])) (define-syntax (calc stx) (syntax-parse stx [(calc c ...) (let ([adds (process-clauses #'(c ...))]) #`'(begin #,@adds))]))) (require 'calc) ; (expression 1) (calc (add 4 5) (sub 10 7) (add 9 10)) ; (expression 2) (define A (calc (add 4 5) (sub 10 7) (add 9 10))) A ; see what A ends up being ; uncomment these to see different output from the preceding expressions: ;(define (add x) (add1 x)) ;(add 6) -- 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. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Open source projects
Do you want drr to open the files? If so, is cmd-shift-O followed by typing an open double quote close enough? Robby On Fri, Oct 20, 2017 at 11:42 AM 'John Clements' via Racket Users < racket-users@googlegroups.com> wrote: > > > On Oct 20, 2017, at 8:06 AM, Vincent St-Amour < > stamo...@eecs.northwestern.edu> wrote: > > > > That page is pretty out of date. > > > > This list is more focused on contributing to Racket itself, but is more > > up to date. It was compiled for the "office hours" portion of the last > > RacketCon, ~2 weeks ago. > > > > > https://github.com/racket/racket/wiki/Racketeer-Office-Hours-2017-Task-Ideas > > There’s something that I now want, and I’m not sure which list to add it > to. Following a discussion with William Hatch about shell usage in Racket, > what I think I really want is auto-completion of filenames in DrRacket, > probably using a pop-up. That is: I type a string containing a path > fragment, and then I hit, say, C-c C-r or some other unused combination > (ha!), and I get a dialog that will allow me with a small number of > keystrokes to auto-complete to the filename that I’m looking for. > > Should be not-too-impossible. > > If I get a spare ten hours, I’d love to do it myself… > > Which list should I add this to? > > John > > cc: william hatch except I’m too busy to > > > > > Vincent > > > > > > On Fri, 20 Oct 2017 05:14:28 -0500, > > Stephen De Gabrielle wrote: > >> > >> There is also a suggested projects page on the wiki > >> > >> https://github.com/racket/racket/wiki/Intro-Projects > >> > >> I don’t know if it is still accurate. > >> > >> Kind regards, > >> > >> Stephen > >> > >> On Fri, 20 Oct 2017 at 06:45, Jack Firth wrote: > >> > >> Welcome, we're very glad to have you! > >> > >> Open source Racket projects are scattered all over the place, but here > are some good ways to find actively maintained and hopefully accessible > projects that might interest you: > >> > >> - Watch some talks from recent RacketCons, especially the most recent > one (which, conveniently, was barely a week and a half ago). A lot of talks > are on interesting and wildly unusual open source projects, and as a bonus > most presenters > >> give out their contact information so people can reach out if they have > questions or might be interested in contributing. You can find information > on the most recent RacketCon at con.racket-lang.org including video and > livestream recordings, > >> talk descriptions, and slides for each talk. Info for previous > RacketCons are available at con.racket-lang.org/2016/, > con.racket-lang.org/2015/, etc. Alas we don't yet have individual > prettily-edited videos for each talk at RacketCon 2017; they're > >> only viewable via the saved livestream on youtube. > >> - Search the official package catalog at pkgs.racket-lang.org for > packages whose descriptions sound interesting and which are hosted on > GitHub / GitLab / some other platform that makes it easy to contribute. > Every package includes links to its > >> docs and repostiory, as well as a contact email address for whoever > maintains it. If you're not looking for a package in a particular problem > domain your best bet is probably to restrict your search to only packages > that build, have passing tests, > >> and have docs. Decent issue / todo lists in the project repo are a nice > bonus. > >> - Browse around the front page of the online Racket documentation at > docs.racket-lang.org. The online docs includes all docs from all > successfully built user packages at pkgs.racket-lang.org, grouped into > top level categories. Once you find > >> some docs for a project that's interesting, it's (hopefully!) not > difficult to find the package containing those docs by searching > pkgs.racket-lang.org. > >> - Hop in the Racket IRC (#racket on freenode) or the Racket Slack > channel (signup at racket-slack.herokuapp.com) and ask around about what > people are working on. I'm sure many folks will be delighted to talk about > their projects. And this > >> mailing list isn't a bad place to ask either. > >> - If you want to try something more ambitious, you can take a peek at > the Github repos in the "racket" organization (https://github.com/racket). > These are all (or mostly? not sure) packages in the "main distribution", > meaning they ship directly with > >> Racket and don't have to be installed by users. Contributing to these > packages can be a little trickier because sometimes they depend on the > latest version of Racket's core, meaning you'll have to compile Racket's > core from source. > >> > >> Also, all throughout this month Github and DigitalOcean are hosting an > online event called Hacktoberfest. By signing up at > https://hacktoberfest.digitalocean.com/ you'll get a free tshirt mailed > to you if you submit four or more pull requests to any > >> public repositories on Github before October ends. It doesn't matter > how large each pull request is and a pull request to your own repo counts. > And
Re: [racket-users] Macro confusion with syntax-parse
Using `~literal` matches by binding, so when `add` is bound by a user's program (shadowing the binding `provide`d from your `calc` module), it no longer matches. You can use `~datum` instead to match `add` symbolically — if you do that in combination with providing an error-raising macro for `add`, you will get an error if the user uses `add` out of context while still allowing her to shadow `add` without interfering with its use in `calc`. (The tradeoff is that the user can no longer use e.g. `rename-in` to get a symbolically different form of `add` that still works with calc.) I am not immediately sure why having a `define` around expression 2 makes a difference, though. I would have expected both expressions to expand to `'(begin)` when the `(define (add x) (add1 x))` un-commented — which is what happens if you put that `define` before expression 1. Here is a version of `calc` that does what I think you want: #lang racket (module calc2 racket (provide calc add) (require (for-syntax syntax/parse)) (define-syntax (add stx) (raise-syntax-error #f "used out of context" stx)) (define-syntax calc (syntax-parser #:datum-literals (add) [(_ (~alt (add x y) ignore:expr) ...) #''(begin (printf "~a~n" (+ x y)) ...)]))) (require 'calc2) ; (expression 1) (calc (add 4 5) (sub 10 7) (add 9 10)) ; (expression 2) (define A (calc (add 4 5) (sub 10 7) (add 9 10))) A ; see what A ends up being (define (add x) (add1 x)) ;the same with or without this -Philip On Fri, Oct 20, 2017 at 11:11 PM, Nadeem Abdul Hamid wrote: > I'm working on a macro that I'd like to work similar to the 'big-bang' > macro of 2htdp/universe with its various clauses, but something's going on > that I don't understand. At the bottom of this email is some code for a > very simple macro, 'calc', that is not what I'm working on, but exhibits > the puzzling behavior. Here, I'm trying to have an expression like > (calc (add 5 6) (add 10 9)) > expand to a block of some other expressions. Just like the behavior of > big-bang, I'd like to raise an error if (add ...) is used in a context > other than as a clause of 'calc'. But I also don't want it to get confused > with another definition of 'add' in the user code. > > With the code below, when run as is, it does what I want - the (calc ...) > expressions - one a top-level expression and the one in (define A (calc > ...)) both expand to a (quoted) s-expression (just for debugging purposes), > namely: > > '(begin >(printf "~a~n" (+ 4 5)) >(printf "~a~n" (+ 9 10))) > > But, if you uncomment the last two lines, which introduces another > definition of 'add', then the first expression still produces the same as > above, but the expansion of the 'A' expression is just '(begin). It seems > like the syntax-parse is no longer matching correctly against the (~literal > add). > > Actually, 'big-bang' also suffers from this same problem -- if you do > (big-bang 0 (on-tick ...)) as a top-level expression in a file with a > definition of (define on-tick add1), it works fine. But if you put the > 'big-bang' inside a define: (define X (big-bang 0 (on-tick ...))) and > don't change anything else it complains about the on-tick "... keyword > being used as a variable..." > > Why does this happen and is there a way to get around this problem -- i.e. > have the behavior of the program below be exactly the same whether there is > a 'define' around the macro use or not? > > Thanks very much for any insight! > > --- nadeem > > > > ;;; > #lang racket > > (module calc racket > (provide calc add) > > (require (for-syntax syntax/parse)) > > (define-for-syntax out-of-context (lambda (stx) (raise-syntax-error #f > "used out of context" stx))) > (define-syntax add out-of-context) > > (define-for-syntax (process-clauses clauses) > (syntax-parse clauses > [(((~literal add) x y) cs ...) #`((printf "~a~n" (+ x y )) > #,@(process-clauses #'(cs ...) > ))] > [(c cs ...) (process-clauses #'(cs ...))] ; skip unexpected > clauses for now > [_ #'()])) > > (define-syntax (calc stx) > (syntax-parse stx > [(calc c ...) >(let ([adds (process-clauses #'(c ...))]) > #`'(begin #,@adds))]))) > > > (require 'calc) > > ; (expression 1) > (calc (add 4 5) > (sub 10 7) > (add 9 10)) > > ; (expression 2) > (define A > (calc (add 4 5) > (sub 10 7) > (add 9 10))) > A ; see what A ends up being > > ; uncomment these to see different output from the preceding expressions: > ;(define (add x) (add1 x)) > ;(add 6) > > > -- > 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.
[racket-users] Define/override for mouse event?
Why do one have to use define/override to get the mouse working on a canvas? Why not just call the method? It’s a little bit confusing. -- 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. For more options, visit https://groups.google.com/d/optout.