On Jun 4, 2018, at 9:48 AM, Alex Gian <alex...@gmail.com> wrote:So I thought I'd start learning the ropes re "how everything fits together" from Simply Scheme, which provides a file called simply.scm that sets up its pedagogical environment (more than a nod to Logo there). Of course, with redefines aplenty this thing had no chance. So here's my first stab, which takes care of everything (I think), and was not too demanding. I now think I understand the scoping of definitions within modules (well, a bit, anyway). Comments, suggestions for improvement, etc, most welcome! What I need to know now, is how can I make this file into a #lang module, so that the user can just type "#lang simply-scheme" and then get on with working through the chapters. Any tips, links to relevant docs or tutorials, discussion sites etc, much appreciated, the subject is not yet anywhere near as well documented as it should be (IMHO).
Finally, I would like my long term project to be the porting of the scmutils/mechanics code from SICM to Racket. For me it is very telling that despite the highly vaunted "simplicity", "portability", etc. of Scheme, this flagship piece of work, from a flagship institution (MIT) and one of the biggest names from the Scheme world (Gerry Sussman) has still not found its way into the Racket ecosystem. I believe that not only is it worthwhile in its own right, but could in fact provide the basis for an excellent embedded computer algebra system. It can't be that difficult. A single individual has done it for Clojure,fantastic piece of work for the JVM, anyone interested in doing something similar for Racket, feel free to say hi.
#lang simply-scheme(define (quotrem n m)(sentence n 'divided 'by m 'is (quotient n m) 'remainder (remainder n m)))(define (acronym phrase)(accumulate word (every first (keep real-word? phrase))))(define (real-word? wd)(not (member? wd '(a the an in of and for to with))))(word 'com 'pu 'tah)(quotrem 144.0 7.0)(acronym '(the structure and interpretation of computer programs))
Welcome to DrRacket, version 6.3 [3m].Language: simply-scheme; memory limit: 512 MB.Loading Simply Scheme...#t'computah'(144.0 divided by 7.0 is 20 remainder 4)'sicp>
On Jun 4, 2018, at 12:48 PM, Alex Gian <alex...@gmail.com> wrote:It became evident to me a good while back, when I tried to show my 13-year old Scheme, via the Little Schemer, and fell flat on the first page, due to the non-standard treatment of symbols there.
As such, I think that it would be great if there was a #lang for every book out there and in this I hope to make a little contribution. Certainly Little/Seasoned Schemer should be no-brainers
Finally, I would like my long term project to be the porting of the scmutils/mechanics code from SICM to Racket.
On Jun 4, 2018, at 5:54 PM, Ben Greenman <benjamin...@gmail.com> wrote:
I have noticed the #lang mechanics package, but somehow I never checked it out, since I thought it was a bit skeletal, certainly incomplete and not sufficient to work twith hrough SICM.
My original plan with the repo was to just port the scheme code, file-by-file. I remember having trouble checking whether the ported code was correct.
Around the time SICM came out, Rebecca Frankel briefly joined our lab. Initially she worked on porting SICM code to PLT Scheme on that basis. This turned out to be pretty hard because "Scheme is the least portable language in the world” (Olin Shivers, repeatedly, forever). She gave up when she realized that Gerry had exploited MIT Scheme-specific knowledge. To read the next sentence, sit down. He had mutated fields in the head of a continuation because he knew you could walk closures as lists and mutate them with set-car! in certain ways. (Her impression was this was a performance trick. I am not so sure. Years later I encountered similar tricks in AD work in a Scheme context.)
15.The insert procedure is ugly:
(define (insert! x set cont)
(cond ((null? set) (cont (list x) 1))
((< x (car set)) (cont (cons x set) 0))
(else (let lp ((i 1) (lst set))
(cond ((null? (cdr lst))
(set-cdr! lst (cons x (cdr lst)))
(cont set i))
((< x (cadr lst))
(set-cdr! lst (cons x (cdr lst)))
(cont set i))
(else (lp (+ i 1) (cdr lst))))))))
On Jun 4, 2018, at 12:48 PM, Alex Gian <alex...@gmail.com> wrote:It became evident to me a good while back, when I tried to show my 13-year old Scheme, via the Little Schemer, and fell flat on the first page, due to the non-standard treatment of symbols there.I can’t parse your paragraph here, specifically the last couple of sentences. Do you mean that TLS’s treatment of symbols is non-standard? TLS uses fonts to “abbreviate” things but that’s explained in the preface. Do you mean Racket’s treatment of symbols is non-standard? Well yes Racket is not Scheme.
I discovered that simply using (provide (all-from-out scheme/base)) would do exactly what i wanted!
I can’t parse your paragraph here, specifically the last couple of sentences. Do you mean that TLS’s treatment of symbols is non-standard? TLS uses fonts to “abbreviate” things but that’s explained in the preface. Do you mean Racket’s treatment of symbols is non-standard? Well yes Racket is not Scheme.
[[ FWIW, I do not think that TLS is a good starting point for normal 13-year olds w/o a prepared adult next to them. ]]
Around the time SICM came out, Rebecca Frankel briefly joined our lab. Initially she worked on porting SICM code to PLT Scheme on that basis. This turned out to be pretty hard because "Scheme is the least portable language in the world” (Olin Shivers, repeatedly, forever). She gave up when she realized that Gerry had exploited MIT Scheme-specific knowledge. To read the next sentence, sit down. He had mutated fields in the head of a continuation because he knew you could walk closures as lists and mutate them with set-car! in certain ways. (Her impression was this was a performance trick. I am not so sure. Years later I encountered similar tricks in AD work in a Scheme context.)
It's probably due this:
> (first 'american) 'a
> (first 'American) "A"Ha-ha, yeah, if there's any uppercase it treats it as a string, otherwise a symbol!However these small niggles don't bother me and I don't think they are a major pedagogical stumbling block.They are trying to get some basic recursion and generalised-list concepts across, and a lot of the ideas seem rooted in vintage LOGO (yes, omg!).However as long as they get the concept across, I think these little idiosyncracies are easily forgivable.At the end of the exercise, I think what's important for the newcomer is to have a sense, of - "Hey, I can do things with this!" rather than "Oh no, what a boring schlepp."If we have to use a bit of "butlast" on symbols that are almost but not quite strings, it's not the end of the world, if they "get" recursion they can move away from all that.And pedagogically some of the clunky Logo-like stuff may be a better idea for kids than an enforced precision that brings in meaningless (to them, at this stage) baggage.That's why I thing all the old books should have #langs, so anyone can play around, no questions asked, no judgement.I seems to me that the inclusive, rather than the elitist approach is what wins people over.
Note that scheme/base refers to the old PLT Scheme language, sothis is different from, say, R5RS.
That sounds like an interesting idea. There's a lot of good ideas in
scmutils. Getting them into the Racket universe would be great.
Konrad.
Welcome to DrRacket, version 6.3 [3m].
Language: scheme/base; memory limit: 512 MB.
Loading Simply Scheme...
All done.
> (every first '(American legacy CODE))
(A l C)
> (every butfirst '(American legacy CODE))
(merican egacy ODE)
--
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+unsubscribe@googlegroups.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...@googlegroups.com.