Re: [racket-users] Racket7 Conceit

2017-07-19 Thread Ben Greenman
mflatt answered some "why"s on the racket-dev list: https://groups.google.com/d/msg/racket-dev/2BV3ElyfF8Y/4RSd3XbECAAJ On Thu, Jul 20, 2017 at 12:34 AM, Lehi Toskin wrote: > I've read through a few README's in the racket7 repo and I can't find > anything specifically about *why* Racket is being

[racket-users] Racket7 Conceit

2017-07-19 Thread Lehi Toskin
I've read through a few README's in the racket7 repo and I can't find anything specifically about *why* Racket is being implemented on top of Chez Scheme, so I suppose I'll be asking here: Why the rewrite in the first place? Is it because C is ugly and yucky and poopy? Why Chez Scheme and not,

Re: [racket-users] Example of file i/o?

2017-07-19 Thread Neil Van Dyke
Since newbies are always listening, I'll just mention something a lot of people here (including Greg) already know. :) Something like `file->lines` is a handy convenience, when you know the file size won't break your system, and/or you're not writing reusable or long-lived code. Good practic

Re: [racket-users] Example of file i/o?

2017-07-19 Thread Leith
That's exactly what I was trying to do - thanks! On Wed, Jul 19, 2017 at 12:26 PM, Greg Hendershott < greghendersh...@gmail.com> wrote: > If you frequently want to deal with files as a list of lines, you > could wrap the code Ben showed you in a function: > > (define (file->lines file) > (with-

Re: [racket-users] Example of file i/o?

2017-07-19 Thread Greg Hendershott
If you frequently want to deal with files as a list of lines, you could wrap the code Ben showed you in a function: (define (file->lines file) (with-input-from-file file (λ () (for/list ([line (in-lines)]) line As it happens, Racket already defines this function for you:

Re: [racket-users] Catching duplicate identifiers.

2017-07-19 Thread Jens Axel Søgaard
To take care of shadowing you need to keep track of which identifiers are declared in each internal definition context. Here is one way to do it. /Jens Axel #lang racket ;;; ;;; Declarations ;;; ;; This is a demonstration of how to write a declaration (or definition) ;; form, that can raise a sy

Re: [racket-users] Questions on HtDP 2e, Ex. 356

2017-07-19 Thread Matthias Felleisen
Hi Ben, as Jens has pointed out, it pays off to read the context of an exercise (like in the real world). The second exercise states > If the terminology poses any difficulties, do re-read BSL Grammar. where “BSL Grammar” is a link that explains BSL via a data definition (that’s what a gram