Re: [racket-users] Re: Getting young children started with Racket
On 04/03/18 13:31, Prabhakar Ragde wrote: > > I used Racket with both my children at age 9. Here is a short writeup > about it originally posted to this mailing list. > > https://web.archive.org/web/20080612194829/http://home.adelphi.edu/sbloch/class/hs/testimonials/prabhakar.shtml > > In answer to your questions, I would say (1) Demo it and see what they > think, but let it be their decision; (2) Yes, the best one I know of!; > (3) They need the potential to grasp the abstractions that an identifier > may refer to a specific value or may range over all values, and the > ability to distinguish those two situations. Seven might be a bit young, > but you know your child best. Bootstrap did not exist when my children > were the right age, and I would definitely think about that now. > > Neil is right that some light instruction combined with suggested but > not required exercises and encouragement to explore is best. Of course > that has to be tailored to the situation. Exploration can be frustrating > if things are obscure or counterintuitive. And my younger child wanted > to learn how to use Terminal in OS X by typing things into it. I had to > explain why that was dangerous! --PR > > Thanks for the writeup. Many interesting ideas on this thread, however I do feel from reading up on this that 7 y.o / 1st grade might be a bit too young (maybe not age wise but certainly school year wise) -- Germany starts off kids in school a bit later than in the UK. Therefore she is just starting to read/write. I will nonetheless try to show her the DrRacket REPL and see what she makes of it following suggestions elsewhere in this thread. Thanks, -- 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] Debugging racket applications
On 05/03/18 17:42, Greg Hendershott wrote: >> OK, doing racket -l errortrace -t as suggested in >> http://docs.racket-lang.org/errortrace/quick-instructions.html helps. > > The equivalent in racket-mode is to set `racket-error-context` to `'high`: > > > https://github.com/greghendershott/racket-mode/blob/master/Reference.md#racket-error-context > Thanks. I was not aware of racket-error-context. > Quote: > > > racket-error-context > > The level of context used for racket-run error stack traces. > > Each level improves stack trace information, but causes your program > to run more slowly. > > - 'low corresponds to compile-context-preservation-enabled #f. > > - 'medium corresponds to compile-context-preservation-enabled #t, > which disables some optimizations like inlining. > > - 'high corresponds to compile-context-preservation-enabled #t and to > use of errortrace, which heavily instruments your code and therefore > may be significantly slower. > > Tip: Regardless of this setting, you can enable 'high errortrace for a > specific racket-run using a C-u prefix. This lets you normally run > with a faster setting, and temporarily re-run to get a more-helpful > error message. > That's great. Thanks once again. -- 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] Debugging racket applications
On 05/03/18 16:20, Matthias Felleisen wrote: > > All debugging aids impose a performance penalty. Always. > > Well, maybe I didn't clarify my comment. However, setting -g on a gcc build does not impose performance penalties. Simply adds debug information (making compile-time slower and executable size larger). However, assembly code generated is the same. It's the use of that information that's the problem -- mainly under a debugger. -- 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] syntax/parse is not hygienic
On Monday, March 5, 2018 at 6:36:09 PM UTC, Alexis King wrote: > I will say this, however: while I have developed over the years a reasonably > strong intuition for how Racket macros operate, when I was learning the macro > system for the first time, I did not find some parts of the hygiene algorithm > terribly intuitive. I am new to both Racket and Scheme in general. When I learned about Scheme's hygienic macros, my (incorrect) understanding has always been close to André van Tonder’s system. I have been programming with this mental modal for months, and only upon reading this discussion did I realize both R6RS and Racket macro systems disagree with my mental modal. I find the existing macro system easier to understand and use, but I am concerned that it may introduce unintentional symbol collisions. From a programmer's perspective, care must be taken when using phase-1 functions, and gensym or others must be used to avoid unintended symbol collision. The situation seems to be similar to that of using unhygienic macros. The problem seems to be a fundamental one, and syntax/parse is only one instance arising from this problem. I recently started switching my projects to Racket because I find it powerful and elegant. I sincerely hope Racket to move in a good direction -- whatever that means. -- 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: Getting young children started with Racket
On Mon, Mar 05, 2018 at 12:13:51PM -0500, 'John Clements' via Racket Users wrote: > > Mathematics is fascinating. It's repetitive arithmetic practice that's > > completely, totally boring and designed to inculcate hatred of the > > subject. > > “designed” ? That is an overstatement, yes. -- hendrik -- 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] any reason why slideshow is still its own executable?
+1 > On Mar 5, 2018, at 8:27 PM, 'John Clements' via Racket Users > wrote: > > Speaking *only* for myself, I like the fact that raco—like git—reduces the > impact of racket on the “global namespace” of executables. I would personally > be happy to have racket, drracket, and raco as the only executables. > > John > >> On Mar 5, 2018, at 12:32 PM, Claes Wallin (韋嘉誠) wrote: >> >> I've been meaning to ask this: What's the scope of raco? Where does the >> community think the line is drawn between what belongs in raco and what >> doesn't? >> >> -- >> /c >> >> On Mar 6, 2018 3:35 AM, "Leif Andersen" wrote: >> Probably just no one has bothered. Adding the following to the >> `slideshow-exe/slideshow` info file adds slideshow to `raco`. >> >> ``` >> (define raco-commands '(("slideshow" >> slideshow/start >> "render a Slideshow document" >> #f))) >> ``` >> >> ~Leif Andersen >> >> >> On Mon, Mar 5, 2018 at 2:25 PM, 'John Clements' via Racket Users >> wrote: >>> I went looking for the standalone slideshow->pdf converter today, and was >>> mystified that it didn’t appear in the list of raco commands. >>> >>> Eventually, I realized that it’s actually its own executable, and has been >>> since before ‘raco’ even existed. >>> >>> Wouldn’t it make more sense for slideshow to be a raco command? Is there an >>> obvious reason why this doesn’t work? >>> >>> John >>> >>> >>> >>> -- >>> 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. >> >> >> -- >> 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. -- 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] any reason why slideshow is still its own executable?
Speaking *only* for myself, I like the fact that raco—like git—reduces the impact of racket on the “global namespace” of executables. I would personally be happy to have racket, drracket, and raco as the only executables. John > On Mar 5, 2018, at 12:32 PM, Claes Wallin (韋嘉誠) wrote: > > I've been meaning to ask this: What's the scope of raco? Where does the > community think the line is drawn between what belongs in raco and what > doesn't? > > -- >/c > > On Mar 6, 2018 3:35 AM, "Leif Andersen" wrote: > Probably just no one has bothered. Adding the following to the > `slideshow-exe/slideshow` info file adds slideshow to `raco`. > > ``` > (define raco-commands '(("slideshow" > slideshow/start > "render a Slideshow document" > #f))) > ``` > > ~Leif Andersen > > > On Mon, Mar 5, 2018 at 2:25 PM, 'John Clements' via Racket Users > wrote: > > I went looking for the standalone slideshow->pdf converter today, and was > > mystified that it didn’t appear in the list of raco commands. > > > > Eventually, I realized that it’s actually its own executable, and has been > > since before ‘raco’ even existed. > > > > Wouldn’t it make more sense for slideshow to be a raco command? Is there an > > obvious reason why this doesn’t work? > > > > John > > > > > > > > -- > > 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. > > > -- > 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] Re: Sorting a list-box%
On Mar 5, 2018, at 4:00 PM, Alex Harsanyi wrote: > If you want to look at a possible implementation, I wrote a wrapper around > list-box% for exactly the purpose of showing SQL query results in a > list-box%. It supports sorting, adding, deleting and updating individual > rows, and you can also reorder and resize columns and this layout is saved > and can be restored: > > https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets.rkt#L982 > > The name of the class is `qresults-list%` and you can find usage examples of > it throughout the application. Thanks. I will definitely check that out. I have another reason to look at ActivityLog2 which is that I am a runner (mostly half marathon and 20K) and I have a Garmin Vivoactive HR. James -- 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] syntax/parse is not hygienic
For those interested, it turns out you can get a loose approximation of the van Tonder system in Racket in just a few dozen lines of code. Namely, you can write a helper that undoes the macro-introduction scope added by the Racket macro system: (begin-for-syntax (define ((make-unscoped-transformer proc) stx) (syntax-local-introduce (proc (syntax-local-introduce stx) Then you can write some functions and forms for keeping track of which scopes to add when users write quote-syntax: (begin-for-syntax (define current-syntax-introducer (make-parameter #f)) (define (current-syntax-introduce stx) ((or (current-syntax-introducer) (make-syntax-introducer)) stx)) (define (call-with-shared-syntax-introducer proc) (if (current-syntax-introducer) (proc) (parameterize ([current-syntax-introducer (make-syntax-introducer)]) (proc (define (call-with-masked-syntax-introducer proc) (parameterize ([current-syntax-introducer #f]) (proc))) (define-simple-macro (with-shared-syntax-introducer body:expr ...+) (call-with-shared-syntax-introducer (λ () body ...))) (define-simple-macro (with-masked-syntax-introducer body:expr ...+) (call-with-masked-syntax-introducer (λ () body ... You can define an introducing variant of quote-syntax in terms of Racket’s quote-syntax: (begin-for-syntax (define-simple-macro (quote-syntax form) (current-syntax-introduce (quote-syntax/no-introduce form And finally, you can implement syntax and quasisyntax in terms of these other forms and functions. That part is the most amount of work, so I haven’t implemented full versions of either, but I implemented simplified versions that don’t handle ellipses and generate less optimal code. The only interesting thing in their implementations is the placement of with-shared-syntax-introducer and with-masked-syntax-introducer. Both expand into uses of with-shared-syntax-introducer, which is wrapped around the entire expansion, and unsyntax must wrap its expression in with-masked-syntax-introducer in its expansion. This produces a system that seems to have the properties of van Tonder’s system in simple situations. Experimentation leads to some interesting behavior. For example, the following macro is completely uninteresting in a system that uses scoped expansion, but it’s quite interesting in one that uses scoped quotation: (define x 'module) (define-syntax mac (make-unscoped-transformer (syntax-parser [(_) #`(let ([x 'local]) (list x #,#'x))]))) (mac) Under scoped-expansion, the program produces the boring result '(local local), but under scoped-quotation, it produces the much more interesting result '(local module)! Maybe some people would find this confusing, but I think it’s a little neat. If anyone is interested in playing with my hacky, incomplete, and probably buggy embedding of this system in Racket, I’ve posted it here: https://gist.github.com/lexi-lambda/a32aab1bb3eccd416764ef90cbd55b67 As a testament to the power of Racket’s macro system and its macro-writing facilities, the whole thing is only 80 lines of code. -- 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.
[racket-users] Re: Sorting a list-box%
You can get the number of rows by calling `get-number` which is an inherited method from list-control<%>. However, you probably want to keep the data separate from the list box and sort that: the list box always contains strings, but your data type might be a number and you want to sort it as such. If you want to look at a possible implementation, I wrote a wrapper around list-box% for exactly the purpose of showing SQL query results in a list-box%. It supports sorting, adding, deleting and updating individual rows, and you can also reorder and resize columns and this layout is saved and can be restored: https://github.com/alex-hhh/ActivityLog2/blob/master/rkt/widgets.rkt#L982 The name of the class is `qresults-list%` and you can find usage examples of it throughout the application. Best regards, Alex. On Tuesday, March 6, 2018 at 1:37:57 AM UTC+8, James wrote: > > I'm working on something which is leading to a cascade of questions so I > suppose that I should just start by explaining what I am trying to do. I > have written some code which takes the results of an SQL query and displays > it as a table in a GUI using list-box%. This works and I am now writing > the callback function. One of the things I want it to do is sort the table > by a given column when you click on that column header. As far as I can > tell, the way to do this is to get the contents of the table, sort it, and > put it back. The Racket Guide doesn't show any way to just get all the data > from the list-box% at once but you can get a row by index number. Fine, so > I could loop through and get all the rows but how do I know how many rows > there are? There isn't a way to get the number of rows directly but there > is a way to get the number of visible items in the list-box% so maybe I > could use that? > > The message is: > (send a-list-box number-of-visible-items) > > So, at this point, I have my callback just using this message to report > back the number of visible items when I click a column header. I have a 4 > x 8 table and it tells me that there are 35 items. Where is this number > coming from? Could it be a pair of opposite off-by-one errors and it > thinks I have a 5x7 table? > > There are ways to get around the problem. I could, for example, maintain > a parallel copy of the contents of the table but I want to write the most > generalizable code possible since I expect to do this kind of thing > repeatedly in different contexts. It seems more reliable to work with the > actual data in the list-box%. > > The bigger question is whether I am going about what I want to do the best > way in the first place. Is list-box really what I want to use? Is there a > better choice? If not, should I work with someone to modify list-box to be > more accommodating to my use case? > > James -- 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] any reason why slideshow is still its own executable?
I've been meaning to ask this: What's the scope of raco? Where does the community think the line is drawn between what belongs in raco and what doesn't? -- /c On Mar 6, 2018 3:35 AM, "Leif Andersen" wrote: Probably just no one has bothered. Adding the following to the `slideshow-exe/slideshow` info file adds slideshow to `raco`. ``` (define raco-commands '(("slideshow" slideshow/start "render a Slideshow document" #f))) ``` ~Leif Andersen On Mon, Mar 5, 2018 at 2:25 PM, 'John Clements' via Racket Users wrote: > I went looking for the standalone slideshow->pdf converter today, and was mystified that it didn’t appear in the list of raco commands. > > Eventually, I realized that it’s actually its own executable, and has been since before ‘raco’ even existed. > > Wouldn’t it make more sense for slideshow to be a raco command? Is there an obvious reason why this doesn’t work? > > John > > > > -- > 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. -- 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] any reason why slideshow is still its own executable?
Probably just no one has bothered. Adding the following to the `slideshow-exe/slideshow` info file adds slideshow to `raco`. ``` (define raco-commands '(("slideshow" slideshow/start "render a Slideshow document" #f))) ``` ~Leif Andersen On Mon, Mar 5, 2018 at 2:25 PM, 'John Clements' via Racket Users wrote: > I went looking for the standalone slideshow->pdf converter today, and was > mystified that it didn’t appear in the list of raco commands. > > Eventually, I realized that it’s actually its own executable, and has been > since before ‘raco’ even existed. > > Wouldn’t it make more sense for slideshow to be a raco command? Is there an > obvious reason why this doesn’t work? > > John > > > > -- > 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.
[racket-users] any reason why slideshow is still its own executable?
I went looking for the standalone slideshow->pdf converter today, and was mystified that it didn’t appear in the list of raco commands. Eventually, I realized that it’s actually its own executable, and has been since before ‘raco’ even existed. Wouldn’t it make more sense for slideshow to be a raco command? Is there an obvious reason why this doesn’t work? John -- 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] syntax/parse is not hygienic
Thank you to both of you for your detailed responses! I think this is all fascinating. > On Mar 5, 2018, at 05:18, Ryan Culpepper wrote: > > 1. Yes. To me, at least :) That aspect of hygiene is triggered by a > macro expansion step, and the macro expansion step also defines the > boundary of its effect. In other words, the expansion of a macro > introduces a scope, but syntax classes do not. Compare with the > following examples: Yes, this is what I meant when I wrote that “Syntax classes behave like phase 1 functions, not macros.” It is worth pointing out, however, that not all things that behave like macros are strictly within the realm of the macroexpander — things like match expanders and syntax/parse pattern expanders manually emulate hygienic expansion despite not ever actually yielding to “the” macroexpander. > 2. I think the main technical challenge is finding all of the syntax > objects to flip the scope on, given that syntax classes allow > attributes to have arbitrary values (like opaque structures and > closures), not just syntax objects. We have a similar problem with > syntax properties, which are invisible to the hygiene algorithm. > > It might be easier in a macro system like Andre van Tonder's system, > as Matthew and Sam mentioned. The parallel with syntax properties is a good one, and it’s something that came to mind to me, too. It seems hard to solve in general automatically, but some cooperation from the user might be enough (via some generic protocol like structure type properties). That’s a bit ugly, though. > 3. Maybe. Half-baked musings follow: If these are your half-baked musings, I would like to see what your fully baked ones look like. :) Your points are good ones, and I agree that I have virtually no intuition for which places the boundaries make sense. I will say this, however: while I have developed over the years a reasonably strong intuition for how Racket macros operate, when I was learning the macro system for the first time, I did not find some parts of the hygiene algorithm terribly intuitive. The fact that quoted syntax could be in wildly different lexical contexts but capture and bind the same identifiers because they were in the same dynamic context seemed antithetical to hygiene to me (which I heard described as “respecting the lexical structure of the program as-written”). I find André van Tonder’s system compelling, but I also agree I can’t really evaluate it without trying to write some programs with it. Maybe, with Racket 7, it’d be easier to implement such a macro system in a fork of Racket for experimentation... but the result might be too incompatible with existing code to serve any purpose. It would be an interesting experiment. > On Mar 5, 2018, at 06:45, Matthew Flatt wrote: > > Adding to Ryan's answer, I note that Andre van Tonder's SRFI-72 system > has `quasisyntax` is a primitive. That is, > > #`(x #,y x) > > is not like > > (datum->syntax #'here (list #'x y #'x)) > > because the scope introduced by a `quasisyntax` spans the whole > `quasisyntax` form and causes nested `syntax` forms to not introduce > a fresh scope. Yes, I noticed that, too. My assumption was that a form like with-fresh-renaming-scope would be necessary, but it would be a little bit different from the version originally described. Rather than require it in order to produce distinct scopes from distinct uses of quotation, keep the behavior of the final version of SRFI 72, but allow with-fresh-renaming-scope (or, most likely, something similar but with a more appropriate name) to *weaken*, not strengthen, the hygiene rules. To illustrate, this would lead to the following behavior: (bound-identifier=? #'x #'x) ; ==> #f (with-fresh-renaming-scope (bound-identifier=? #'x #'x)) ; ==> #t If uses of with-fresh-renaming-scope are nested, the outermost use “wins”, yielding the following behavior: (with-fresh-renaming-scope (bound-identifier=? (with-fresh-renaming-scope #'x) (with-fresh-renaming-scope #'x))) ; ==> #t This would allow forms like quasisyntax to introduce with-fresh-renaming-scope in their expansions to avoid distinct uses of syntax from generating distinct identifiers while simultaneously allowing new abstractions to be defined in terms of quasisyntax just as quasisyntax is defined in terms of syntax. Some parts of this are still a little unsatisfying, however. The draft of SRFI 72 you link defines with-fresh-renaming-scope as applying lexically, not dynamically, but it isn’t immediately obvious to me which is the correct behavior in this case. Furthermore, if it applies lexically, what does it mean when with-fresh-renaming-scope is introduced by a macro? If it applies to all identifiers inside its expansion, that feels unhygienic enough to cause trouble... so my own intuition here is nonexistent. As for looking at the discussion, it doesn’t appear to be particularly illustrative. As far as the archiv
Re: [racket-users] Re: Getting young children started with Racket
Lets not meander off the question, shall we? For an intro to programming - quickly seeing what and why happens trumps things like S-expressions vs identation, functional vs imperative, name it. What matters is that kids can form some mental model of what is happening and why. Thus feedback matters quite a lot. The problem will be what material you choose and how you would present it. Making this on your own may be harder than expected. I found How to Design Programs ed.1 is way too repetetive and monotone. Realm of Racket is better but I think suited to kids 10 and above. How to Design Programs ed.2 seems good but I have not tried it yet. There are quite a few books on Scratch and ScratchJr though they lean very much towards gaming/entertainment style (which is not bad). The bootstrap initiatives are also targeted at a higher age. I will test DrRacket on my 8 year old son and will try to get some feedback. Regards: al_shopov На пн, 5.03.2018 г. в 18:13 ч. 'John Clements' via Racket Users < racket-users@googlegroups.com> написа: > > Mathematics is fascinating. It's repetitive arithmetic practice that's > > completely, totally boring and designed to inculcate hatred of the > > subject. > > “designed” ? > > John > > > > -- > 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.
[racket-users] Sorting a list-box%
I'm working on something which is leading to a cascade of questions so I suppose that I should just start by explaining what I am trying to do. I have written some code which takes the results of an SQL query and displays it as a table in a GUI using list-box%. This works and I am now writing the callback function. One of the things I want it to do is sort the table by a given column when you click on that column header. As far as I can tell, the way to do this is to get the contents of the table, sort it, and put it back. The Racket Guide doesn't show any way to just get all the data from the list-box% at once but you can get a row by index number. Fine, so I could loop through and get all the rows but how do I know how many rows there are? There isn't a way to get the number of rows directly but there is a way to get the number of visible items in the list-box% so maybe I could use that? The message is: (send a-list-box number-of-visible-items) So, at this point, I have my callback just using this message to report back the number of visible items when I click a column header. I have a 4 x 8 table and it tells me that there are 35 items. Where is this number coming from? Could it be a pair of opposite off-by-one errors and it thinks I have a 5x7 table? There are ways to get around the problem. I could, for example, maintain a parallel copy of the contents of the table but I want to write the most generalizable code possible since I expect to do this kind of thing repeatedly in different contexts. It seems more reliable to work with the actual data in the list-box%. The bigger question is whether I am going about what I want to do the best way in the first place. Is list-box really what I want to use? Is there a better choice? If not, should I work with someone to modify list-box to be more accommodating to my use case? James -- 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: Getting young children started with Racket
> Mathematics is fascinating. It's repetitive arithmetic practice that's > completely, totally boring and designed to inculcate hatred of the > subject. “designed” ? John -- 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] Debugging racket applications
When I started programming, debuggers seemed like magic. Eventually I realized that a debugger "just" rewrites your program into a debug-able (e.g. trace-able and/or step-able) version of your program.[^1] Which means a more complicated -- and without hardware assistance, significantly slower -- version of your program. [1]: For example: https://github.com/racket/drracket/blob/abf1af0b2afa5d18b711366da8d1dfb1cd8b2937/drracket/gui-debugger/annotator.rkt -- 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] Debugging racket applications
> OK, doing racket -l errortrace -t as suggested in > http://docs.racket-lang.org/errortrace/quick-instructions.html helps. The equivalent in racket-mode is to set `racket-error-context` to `'high`: https://github.com/greghendershott/racket-mode/blob/master/Reference.md#racket-error-context Quote: racket-error-context The level of context used for racket-run error stack traces. Each level improves stack trace information, but causes your program to run more slowly. - 'low corresponds to compile-context-preservation-enabled #f. - 'medium corresponds to compile-context-preservation-enabled #t, which disables some optimizations like inlining. - 'high corresponds to compile-context-preservation-enabled #t and to use of errortrace, which heavily instruments your code and therefore may be significantly slower. Tip: Regardless of this setting, you can enable 'high errortrace for a specific racket-run using a C-u prefix. This lets you normally run with a faster setting, and temporarily re-run to get a more-helpful error message. -- 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] Debugging racket applications
All debugging aids impose a performance penalty. Always. > On Mar 5, 2018, at 10:07 AM, 'Paulo Matos' via Racket Users > wrote: > > > > On 05/03/18 15:28, 'Paulo Matos' via Racket Users wrote: >> >> Is there anything I can try to improve backtrace generation? >> > > OK, doing racket -l errortrace -t as suggested in > http://docs.racket-lang.org/errortrace/quick-instructions.html helps. > > Does errortrace introduce a performance penalty or simply adds debug > information ala -g in traditional compilers? > > -- > 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. -- 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] Debugging racket applications
On 05/03/18 15:28, 'Paulo Matos' via Racket Users wrote: > > Is there anything I can try to improve backtrace generation? > OK, doing racket -l errortrace -t as suggested in http://docs.racket-lang.org/errortrace/quick-instructions.html helps. Does errortrace introduce a performance penalty or simply adds debug information ala -g in traditional compilers? -- 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] syntax/parse is not hygienic
At Sun, 4 Mar 2018 20:01:56 -0800, Alexis King wrote: > While it’s a bit of a tangent, I’d be quite interested to finding more > information on this alternate model of hygiene from anyone familiar with > the tradeoffs (the SRFI that describes it does not include much in the > way of comparisons). Are there strong reasons to prefer Racket’s model > aside from backwards compatibility and mild convenience when > procedurally assembling pieces of syntax? Adding to Ryan's answer, I note that Andre van Tonder's SRFI-72 system has `quasisyntax` is a primitive. That is, #`(x #,y x) is not like (datum->syntax #'here (list #'x y #'x)) because the scope introduced by a `quasisyntax` spans the whole `quasisyntax` form and causes nested `syntax` forms to not introduce a fresh scope. Is `quasisyntax` special enough to be built in? What about other syntactic forms that would be naturally implemented with multiple `syntax` (or `quote-syntax`) forms? Looking back, I see that SRFI-72 at one point included a `with-fresh-renaming-scope` operation that very close to (or maybe exactly) what I had in mind by "applying a fresh scope to a textual region of syntax literals": https://srfi.schemers.org/srfi-72/srfi-72-1.3.html To me, that seems like a way to pull the specialness out of `syntax` and `quasisyntax`, although it also seems inconvenient to have to write `with-fresh-renaming-scope` explicitly (which that connects to Ryan's comments on `syntax-protect`). But I haven't looked in detail, and I may be mixing things up. You may find something in the SRFI-72 discussion on why that direction was abandoned. -- 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.
[racket-users] Debugging racket applications
Hi, I have been using Greg's racket mode and racket on the command line to start my application. One of the most frustrating/infuriating things about full time racket programming at the moment is debugging. For example, here's a run of my program: $ racket /var/tmp/lt15198411601519841160715/0/driver-0.rkt <: contract violation expected: real? given: #f argument position: 2nd other arguments...: 1 context...: /home/pmatos/Projects/lt/lt/stochastic.rkt:179:26 /var/tmp/lt15198411601519841160715/0/driver-0.rkt: [running body] The context is quite unhelpful. Like 179 of stochastic.rkt is: (lambda (candidate) There's no call to '<' anywhere nearby. DrRacket is not that much more helpful. If it helps, I currently setup my project as: raco pkg install --auto --link raco setup --tidy --check-pkg-deps --unused-pkg-deps --pkgs lt Is there anything I can try to improve backtrace generation? Kind regards, -- 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: Getting young children started with Racket
On Mon, Mar 05, 2018 at 01:47:13AM -0800, HiPhish wrote: > > As for Racket, I'm not quite sure. I think the S-expression syntax, > immutability and functional programming are a bit harder to wrap your mind > around than the usual way of giving the computer a sequence of instructions > to > follow. Maybe Python would be a better choice, it also has a much larger > selection of libraries. But it could also be because I originally came from > the > imperative way of programming that I found the Lisp languages so weird. S-expression syntax is troublesome when the parentheses get too deeply nested. Otherwise it's just fine. Having different kinds of parentheses is a huge improvement. But immutability actually makes a lot of things easier rather than harder, in that things don't change under your feet while you're using them. Of course, you don't want *everything* to be immutable. A lot of things are indeed easier to thin of in terms of change in time. And you do want to be able to interact with, say, the game player. You want mutability without hindrance when you need it. But not when you don't. > > I don't think being able to do math would be that interesting for a child. Mathematics is fascinating. It's repetitive arithmetic practice that's completely, totally boring and designed to inculcate hatred of the subject. -- hendrik -- 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] Getting young children started with Racket
> On Mar 5, 2018, at 4:47 AM, HiPhish wrote: > > As for Racket, I'm not quite sure. ... > immutability and functional programming are a bit harder to wrap your mind > around than the usual way of giving the computer a sequence of instructions to > follow. Do you also think that calculating is hard? That using a calculator is hard? Kids are bombarded with immutability for 12 years in American schools .. it’s called mathematics, and most of the math is programming, except that we don’t do it that way. Have you ever thought that programming could reinforce math and math could directly, without detour reinforce programming? Have thought about the idea that coding could animate math tremendously and that math could power coding beyond the boring ladybug chasing with step-by-step commands? Did you ever consider that a parent may wish to teach a child how to code but that the child should still be free to become a doctor, journalist, or accountant .. and that the coding lessons should help with all of these professions? This is where Racket actually comes from. — Matthias, long live S-expressions -- 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] syntax/parse is not hygienic
On 03/04/2018 09:40 PM, Alexis King wrote: [... context ...] Still, with all this context out of the way, my questions are comparatively short: 1. Is this lack of hygiene well-known? I did not find anything in Ryan’s dissertation that explicitly dealt with the question, but I did not look very hard, and even if it isn’t explicitly mentioned there, I imagine people have thought about it before. 2. Are there some fundamental, theoretical obstacles to making a syntax class-like thing hygienic that I have not foreseen? Or would it really be as simple as performing the usual scope-flipping that macroexpansion already performs? 3. If it is possible, is the unhygienic nature of syntax classes desirable frequently enough that it outweighs the benefits of respecting hygiene? That seems unlikely to me, but maybe I have not fully considered the problem. The semantics of syntax classes cannot be changed now, of course, for backwards compatibility reasons, but were that not a problem, would it make sense to make them hygienic? If not, why not? 1. Yes. To me, at least :) That aspect of hygiene is triggered by a macro expansion step, and the macro expansion step also defines the boundary of its effect. In other words, the expansion of a macro introduces a scope, but syntax classes do not. Compare with the following examples: (define x 'old) (begin-for-syntax (define (get-def) #'(define x 'new)) (define (get-use) #'x)) (define-syntax (m1 stx) #`(begin #,(get-def) #,(get-use))) (m1) ;; => 'new (define-syntax (m2 stx) (let ([expr #'x]) #`(let ([x 'new]) #,expr))) (m2) ;; => 'new Contrast with systems like MetaML, which strictly enforce lexical scoping but don't actually give you macros. 2. I think the main technical challenge is finding all of the syntax objects to flip the scope on, given that syntax classes allow attributes to have arbitrary values (like opaque structures and closures), not just syntax objects. We have a similar problem with syntax properties, which are invisible to the hygiene algorithm. It might be easier in a macro system like Andre van Tonder's system, as Matthew and Sam mentioned. 3. Maybe. Half-baked musings follow: There are two good ideas in opposition here. One is hygiene. The other is the availability of pure abstractions. As a new grad student, I spent some time playing with plain R5RS-style syntax-rules macros. My first presentation in grad school was on an EOPL-style interpreter I wrote using nothing but syntax-rules macros. It did integer arithmetic (using a unary encoding of integers as parentheses), it did closures, it did continuations... all at compile time. But I discovered that there were things I couldn't express the way I wanted because the only available abstraction mechanism (the macro definition) was tangled up with the hygiene effect. I don't remember the exact situations, but they had the following form: I needed macro-generated-macro X to produce exactly identifier Y, but it could only produce Y with a mark. Of course, most of these "macros" were really implementation fragments of something else; I was forced to break them out into separate pieces because of the limitations of the language I chose to work in. Hygienic macros are impure abstractions. (Other examples of impure abstractions: Javascript functions, if you do reflection on the current activation record, and Prolog predicates, which delimit the effect of a cut.) They still win, because despite being impure at the syntax object level, they approximate this nice lexical scoping property one level up, the level of interpreting the syntax objects as expressions, definitions, etc. (I say "approximate" because of the examples I gave in part 1.) But I think the win depends on the placement of the hygiene boundaries. My interpreter experience makes me think that too many boundaries within the implementation of a macro can be bad. So another framing of the question is where should the boundaries go?[*] The one that corresponds to a macro expansion step is nice because macro expansion occurs at expression (or more precisely, "form") positions, and that connects the hygiene boundary with the interpretation level where lexical scoping is defined. Are there other "meaningful" places to put hygiene boundaries? Do syntax classes necessarily correspond with meaningful boundaries? Or are meaningful boundaries not actually that important? ([*] Matthew and I had a similar problem regarding syntax certificates, which evolved into the current dye pack and tainting system. We couldn't find a good way to identify anchors in the source code that represented discrete macro implementations that could be automatically protected, so we left it to the programmer to call syntax-protect explicitly. (Or use syntax-rules.) The problem is th
[racket-users] Re: Getting young children started with Racket
I am not a father, so take everything with a grain of salt from me. Also, obvious disclaimer, every child is different, you know your children best, and all the usual stuff... With that out of the way, I think computer illiteracy is one of the big injustices that gets perpetrated in our modern society, people are being raised to see computers as magic boxes and you are expected to be just a corporate slave. Just look at the new Apple iPad commercial where the kid goes "what's a computer?" and this is somehow supposed to be a good thing. Every person should know the basics of how to use the command-line interface and write simple programs. I view it like being mechanically competent: not everyone needs to be a bike mechanic, but everyone should be able to at least fix a flat tire or replace worn-out brakes. Imagine how pathetic and helpless you would be if your bike had a flat tire and you had to bring it to a repair shop and wait several days for something a person with basic training could get done in a few minutes. The same with computers. Being able to pipe together something in a shell or throw together a quick script to get a job done frees people from being dependent on corporations. Case in point, a while ago I was looking for a way to split a PDF exactly in two, and after half an hour or so searching for a program I was like "WTF am I doing with my life?" and gave up, so instead I grabbed some Python PDF library, skimmed the documentation and within five minutes I had a script that did exactly what I wanted. With that said, I think first grade is a bit too young, but then again, every child is different. You have to be careful to not make computers boring, complicated or lame for her, or else you will put her off forever. I also noticed that some people simply do not want to be tech-literate; I don't understand it, but they are hostile to even the idea of learning the basics of any craft. You will have to consider that possibility as well. As for Racket, I'm not quite sure. I think the S-expression syntax, immutability and functional programming are a bit harder to wrap your mind around than the usual way of giving the computer a sequence of instructions to follow. Maybe Python would be a better choice, it also has a much larger selection of libraries. But it could also be because I originally came from the imperative way of programming that I found the Lisp languages so weird. I don't think being able to do math would be that interesting for a child. How about instead you try making small arcade-like games together? Something like a match-3 game or Snake (girls like cute games about eating stuff, PacMan was specifically made to appeal to girls), a game that doesn't use scrolling and not complicated collision detection. Or maybe some graphical programming environment where you drag and drop commands instead of typing them. I don't know what exists in that regard though, so I can't help you. I remember in school we had a program where you had a little robot that would move tile by tile, and you could program it in its own (very primitive) language. Here is something similar to that: https://www.swisseduc.ch/compscience/karatojava/javakara/ Now that I think about it, making something similar in Racket to be controlled with a language that's not a bastardised Java would be a really cool project (not for a child of course). On Saturday, March 3, 2018 at 2:41:16 PM UTC+1, Paulo Matos wrote: > > Hello, > > I have a 7yo daughter currently in 1st grade (Germany) and she was given > a password for the school computer. Having never touched a computer > before she is now being introduced to typing and the mouse. > > I wonder if anyone has any experience with the following: > > 1. Is it useful for a child this age to get introduced to programming if > they are not actively looking to learn? > 2. Is racket a good way to introduce it? > 3. Is 7yo / 1st grade a good time or too early and I should wait? > > Of course, I can say, look... those math exercises you have? (16 - 2 = > _, 10 + 18 = _, etc) You can check your answers with a computer, you > have to type (- 16 2), (+ 10 18), etc. But is it useful or a waste of > mine and her time and there's a better way to begin? > > Kind regards, > -- > 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.