Re: [racket-users] Racket for Kids in 2017

2017-05-28 Thread Neil Van Dyke

Stephen De Gabrielle wrote on 05/28/2017 09:08 AM:
> But don't discount the potential of throwing a young child at a 
computer with

> only non-child software on it, and let them figure out
> how to do what they want, much on their own. That's how the early-1980s
> home computer kids got started, and that worked out pretty well.



Survivorship bias?


Could be; good point.  (I've seen and suspected a lot of survivor bias 
in academia, in various ways, especially around the fancy-pants schools, 
and around narrow STEM paths; but that's another conversation.)


I know only a little of the work that has been done on this, by 
education and developmental researchers, so I overstated my 
non-specialist's opinion.  My bad.


My *anecdotal experience and inexpert intuition* is that self-motivated 
play by young children, who are in sponge mode, can be a powerful 
learning machine, especially when given helpful nudges/nurturing.  
Seymour Papert and others have worked on this.


And I believe I've observed the influence of people feeling that they 
are doing well, or doing badly, at something new.  So I suspect that 
nudging that, as needed, can be key to the learner putting in enough 
time and effort to do well.


I doubt that these general ideas would be controversial among actual 
experts, but of course there must also be a lot more going on and 
important, which they also know something about.


--
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] making a language that can return the body of a function

2017-05-28 Thread Vityou
I just noticed that the stepper for intermediate student with lambda pretty 
much does what I want.  I guess I can look into that.

On Sunday, May 28, 2017 at 7:55:08 PM UTC-6, Matthias Felleisen wrote:
> I misunderstood because of your mismatched parentheses. Without eval, you 
> can’t do better than that. Parens rock. 
> 
> 
> > On May 28, 2017, at 9:51 PM, Vityou  wrote:
> > 
> > On Sunday, May 28, 2017 at 2:01:09 PM UTC-6, Matthias Felleisen wrote:
> >> You need to apply the function, not just compute the substitution. See 
> >> applicable struct in previous message. This should just work out, w/o much 
> >> ado. 
> >> 
> >> 
> >> 
> >>> On May 28, 2017, at 12:40 AM, Vityou  wrote:
> >>> 
> >>> On Thursday, May 25, 2017 at 5:50:29 PM UTC-6, Matthias Felleisen wrote:
>  The client module can refer to all imported #% forms. If you don’t 
>  export it from the language module, it’s not there. [Well, mostly] 
>  Implicitly the client module already refers to #% forms already. 
>  
>  
>  
> > On May 25, 2017, at 7:09 PM, Vityou  wrote:
> > 
> > On Wednesday, May 24, 2017 at 2:05:23 PM UTC-6, Matthias Felleisen 
> > wrote:
> >> Don’t eval. This is a bit crude but it now your lam-s keep track of 
> >> your environment, too. 
> >> 
> >> #lang racket ;; new-lang.rkt 
> >> 
> >> (provide
> >> #%app
> >> #%datum
> >> #%top-interaction
> >> (rename-out
> >> (new-lambda lambda)
> >> (new-mb #%module-begin)))
> >> 
> >> (require racket/stxparam)
> >> 
> >> (define-syntax (new-lambda stx)
> >> (syntax-case stx ()
> >>  [(_ (x ...) e ...)
> >>   #`(letrec ([L (lam '(x ...)
> >>  '(e ...)
> >>  (*env)
> >>  (lambda (x ...)
> >>(syntax-parameterize ([*env
> >>   (lambda (stx)
> >> (syntax-case stx ()
> >>   [(_) #`(append '(x 
> >> ...) (lam-environment L))]))])
> >>  e)
> >>...))])
> >>   L)]))
> >> (define-syntax-parameter *env
> >> (syntax-rules () [(_) '()]))
> >> (struct lam (parameters bodies environment closure) #:property 
> >> prop:procedure 3)
> >> 
> >> (define-syntax (new-mb stx)
> >> (syntax-case stx ()
> >>  [(_ e ...)
> >>   #'(#%module-begin
> >>  (let ([v e])
> >>(if (lam? v)
> >>`(let (,@(map (lambda (x) `(,x --some-value--)) 
> >> (lam-environment v)))
> >>   (lambda ,(lam-parameters v) ,@(lam-bodies v)))
> >>v))
> >>  ...)]))
> >> 
> >> 
> >> 
> >>> On May 24, 2017, at 3:41 PM, Vityou  wrote:
> >>> 
> >>> On Wednesday, May 24, 2017 at 12:05:19 PM UTC-6, Vityou wrote:
>  On Tuesday, May 23, 2017 at 8:21:59 PM UTC-6, Matthias Felleisen 
>  wrote:
> > Try to start with this: 
> > 
> > 
> > 
> > 
> > 
> > #lang racket ;; new-lang.rkt 
> > 
> > 
> > (provide
> > #%app
> > #%datum
> > #%top-interaction
> > (rename-out
> > (new-lambda lambda)
> > (new-mb #%module-begin)))
> > 
> > 
> > (define-syntax (new-lambda stx)
> > (syntax-case stx ()
> >  [(_ (x ...) e ...)
> >   #'(lam '(x ...) '(e ...) (lambda (x ...) e ...))]))
> > 
> > 
> > (struct lam (parameters bodies closure) #:property prop:procedure 2)
> > 
> > 
> > (define-syntax (new-mb stx)
> > (syntax-case stx ()
> >  [(_ e ...)
> >   #'(#%module-begin
> >  (let ([v e])
> >(if (lam? v)
> >`(lambda ,(lam-parameters v) ,@(lam-bodies v))
> >v))
> >  ...)]))
> > 
> > 
> > 
> > 
> > ;; - - - 
> > 
> > 
> > 
> > #lang s-exp "new-lang.rkt” ;; new-lang-client.rkt 
> > 
> > 
> > ((lambda (x) x)
> > (lambda (y) y))
> > 
> > 
> > 
> > 
> > 
> > 
> > On May 23, 2017, at 10:03 PM, Vityou  wrote:
> > 
> > 
> > On Tuesday, May 23, 2017 at 7:17:18 PM UTC-6, Matthias Felleisen 
> > wrote:
> > Why do you interpret S-expressions instead of re-mapping lambda and 
> > #%app? 
> > 
> > 
> > 
> > 
> > 
> > On May 23, 2017, at 9:14 PM, Vityou  wrote:
> > 
> > I might be able to do 

Re: [racket-users] using a created language in the repl

2017-05-28 Thread Vityou
I think what happens is that when you use the language with the repl it ignores 
the reader and just looks at the exports from the language (main.rkt).

On Thursday, May 25, 2017 at 10:14:58 AM UTC-6, Dmitry Pavlov wrote:
> Vityou,
> 
> 
> 
> I will give you an example though I myself sometimes doubt that I
> did it in the right way.
> 
> 
> 
> Anyway, here is what I did when I had exactly the same problem:
> 
> 
> 
> - redefine and reexport #%
> 
> top-interaction
> 
> - provide #:language-info to the DrRacket's REPL (I am not sure if
> racket's REPL needs it too, but doing it will not hurt). The
> provided call should respond to 'configure-runtime key 
> 
> - the 'configure-runtime should trigger a setting of
> (current-read-interaction) parameter.
> 
> - at the end of the implementation of (current-read-interaction), it
> should set another (current-read-interaction) that just returns EOF
> -- and then sets the original (current-read-interaction) back, so it
> is kind of a loop.
> 
> 
> 
> The example (made long ago) is available at:
> https://github.com/kugelblitz/calc
> 
> 
> 
> Relevant parts:
> 
> /language.rkt (see top-interaction)
> 
> /lang/reader.rkt (reference to lang-info)
> 
> /lang/lang-info.rkt (calling of "configure runtime" handler)
> 
> /lang/configure-runtime.rkt (the handler itself)
> 
> 
> 
> Hope this helps.
> 
> 
> 
> Dmitry
> 
> 
> 
> 
> 
> 
> 
> 
> On 05/18/2017 06:45 AM, Vityou wrote:
> 
> 
> 
>   I did reprovide all of the #%... forms from racket, and the repl works 
> with base.rkt, it's when I have a reader that the repl doesn't work.

-- 
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] making a language that can return the body of a function

2017-05-28 Thread Matthias Felleisen

I misunderstood because of your mismatched parentheses. Without eval, you can’t 
do better than that. Parens rock. 


> On May 28, 2017, at 9:51 PM, Vityou  wrote:
> 
> On Sunday, May 28, 2017 at 2:01:09 PM UTC-6, Matthias Felleisen wrote:
>> You need to apply the function, not just compute the substitution. See 
>> applicable struct in previous message. This should just work out, w/o much 
>> ado. 
>> 
>> 
>> 
>>> On May 28, 2017, at 12:40 AM, Vityou  wrote:
>>> 
>>> On Thursday, May 25, 2017 at 5:50:29 PM UTC-6, Matthias Felleisen wrote:
 The client module can refer to all imported #% forms. If you don’t export 
 it from the language module, it’s not there. [Well, mostly] Implicitly the 
 client module already refers to #% forms already. 
 
 
 
> On May 25, 2017, at 7:09 PM, Vityou  wrote:
> 
> On Wednesday, May 24, 2017 at 2:05:23 PM UTC-6, Matthias Felleisen wrote:
>> Don’t eval. This is a bit crude but it now your lam-s keep track of your 
>> environment, too. 
>> 
>> #lang racket ;; new-lang.rkt 
>> 
>> (provide
>> #%app
>> #%datum
>> #%top-interaction
>> (rename-out
>> (new-lambda lambda)
>> (new-mb #%module-begin)))
>> 
>> (require racket/stxparam)
>> 
>> (define-syntax (new-lambda stx)
>> (syntax-case stx ()
>>  [(_ (x ...) e ...)
>>   #`(letrec ([L (lam '(x ...)
>>  '(e ...)
>>  (*env)
>>  (lambda (x ...)
>>(syntax-parameterize ([*env
>>   (lambda (stx)
>> (syntax-case stx ()
>>   [(_) #`(append '(x 
>> ...) (lam-environment L))]))])
>>  e)
>>...))])
>>   L)]))
>> (define-syntax-parameter *env
>> (syntax-rules () [(_) '()]))
>> (struct lam (parameters bodies environment closure) #:property 
>> prop:procedure 3)
>> 
>> (define-syntax (new-mb stx)
>> (syntax-case stx ()
>>  [(_ e ...)
>>   #'(#%module-begin
>>  (let ([v e])
>>(if (lam? v)
>>`(let (,@(map (lambda (x) `(,x --some-value--)) 
>> (lam-environment v)))
>>   (lambda ,(lam-parameters v) ,@(lam-bodies v)))
>>v))
>>  ...)]))
>> 
>> 
>> 
>>> On May 24, 2017, at 3:41 PM, Vityou  wrote:
>>> 
>>> On Wednesday, May 24, 2017 at 12:05:19 PM UTC-6, Vityou wrote:
 On Tuesday, May 23, 2017 at 8:21:59 PM UTC-6, Matthias Felleisen wrote:
> Try to start with this: 
> 
> 
> 
> 
> 
> #lang racket ;; new-lang.rkt 
> 
> 
> (provide
> #%app
> #%datum
> #%top-interaction
> (rename-out
> (new-lambda lambda)
> (new-mb #%module-begin)))
> 
> 
> (define-syntax (new-lambda stx)
> (syntax-case stx ()
>  [(_ (x ...) e ...)
>   #'(lam '(x ...) '(e ...) (lambda (x ...) e ...))]))
> 
> 
> (struct lam (parameters bodies closure) #:property prop:procedure 2)
> 
> 
> (define-syntax (new-mb stx)
> (syntax-case stx ()
>  [(_ e ...)
>   #'(#%module-begin
>  (let ([v e])
>(if (lam? v)
>`(lambda ,(lam-parameters v) ,@(lam-bodies v))
>v))
>  ...)]))
> 
> 
> 
> 
> ;; - - - 
> 
> 
> 
> #lang s-exp "new-lang.rkt” ;; new-lang-client.rkt 
> 
> 
> ((lambda (x) x)
> (lambda (y) y))
> 
> 
> 
> 
> 
> 
> On May 23, 2017, at 10:03 PM, Vityou  wrote:
> 
> 
> On Tuesday, May 23, 2017 at 7:17:18 PM UTC-6, Matthias Felleisen 
> wrote:
> Why do you interpret S-expressions instead of re-mapping lambda and 
> #%app? 
> 
> 
> 
> 
> 
> On May 23, 2017, at 9:14 PM, Vityou  wrote:
> 
> I might be able to do something like this, but what I'm looking for 
> is something that will be able to show the variables available to it 
> in adition to its source.  I'll probable have to do something like 
> what you did with the struct accept add a field with its available 
> variables and modify #%app to add to its known variables.
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Racket Users" group.
> To unsubscribe from 

Re: [racket-users] making a language that can return the body of a function

2017-05-28 Thread Vityou
On Sunday, May 28, 2017 at 2:01:09 PM UTC-6, Matthias Felleisen wrote:
> You need to apply the function, not just compute the substitution. See 
> applicable struct in previous message. This should just work out, w/o much 
> ado. 
> 
> 
> 
> > On May 28, 2017, at 12:40 AM, Vityou  wrote:
> > 
> > On Thursday, May 25, 2017 at 5:50:29 PM UTC-6, Matthias Felleisen wrote:
> >> The client module can refer to all imported #% forms. If you don’t export 
> >> it from the language module, it’s not there. [Well, mostly] Implicitly the 
> >> client module already refers to #% forms already. 
> >> 
> >> 
> >> 
> >>> On May 25, 2017, at 7:09 PM, Vityou  wrote:
> >>> 
> >>> On Wednesday, May 24, 2017 at 2:05:23 PM UTC-6, Matthias Felleisen wrote:
>  Don’t eval. This is a bit crude but it now your lam-s keep track of your 
>  environment, too. 
>  
>  #lang racket ;; new-lang.rkt 
>  
>  (provide
>  #%app
>  #%datum
>  #%top-interaction
>  (rename-out
>  (new-lambda lambda)
>  (new-mb #%module-begin)))
>  
>  (require racket/stxparam)
>  
>  (define-syntax (new-lambda stx)
>  (syntax-case stx ()
>    [(_ (x ...) e ...)
> #`(letrec ([L (lam '(x ...)
>    '(e ...)
>    (*env)
>    (lambda (x ...)
>  (syntax-parameterize ([*env
> (lambda (stx)
>   (syntax-case stx ()
> [(_) #`(append '(x 
>  ...) (lam-environment L))]))])
>    e)
>  ...))])
> L)]))
>  (define-syntax-parameter *env
>  (syntax-rules () [(_) '()]))
>  (struct lam (parameters bodies environment closure) #:property 
>  prop:procedure 3)
>  
>  (define-syntax (new-mb stx)
>  (syntax-case stx ()
>    [(_ e ...)
> #'(#%module-begin
>    (let ([v e])
>  (if (lam? v)
>  `(let (,@(map (lambda (x) `(,x --some-value--)) 
>  (lam-environment v)))
> (lambda ,(lam-parameters v) ,@(lam-bodies v)))
>  v))
>    ...)]))
>  
>  
>  
> > On May 24, 2017, at 3:41 PM, Vityou  wrote:
> > 
> > On Wednesday, May 24, 2017 at 12:05:19 PM UTC-6, Vityou wrote:
> >> On Tuesday, May 23, 2017 at 8:21:59 PM UTC-6, Matthias Felleisen wrote:
> >>> Try to start with this: 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> #lang racket ;; new-lang.rkt 
> >>> 
> >>> 
> >>> (provide
> >>> #%app
> >>> #%datum
> >>> #%top-interaction
> >>> (rename-out
> >>> (new-lambda lambda)
> >>> (new-mb #%module-begin)))
> >>> 
> >>> 
> >>> (define-syntax (new-lambda stx)
> >>> (syntax-case stx ()
> >>>   [(_ (x ...) e ...)
> >>>#'(lam '(x ...) '(e ...) (lambda (x ...) e ...))]))
> >>> 
> >>> 
> >>> (struct lam (parameters bodies closure) #:property prop:procedure 2)
> >>> 
> >>> 
> >>> (define-syntax (new-mb stx)
> >>> (syntax-case stx ()
> >>>   [(_ e ...)
> >>>#'(#%module-begin
> >>>   (let ([v e])
> >>> (if (lam? v)
> >>> `(lambda ,(lam-parameters v) ,@(lam-bodies v))
> >>> v))
> >>>   ...)]))
> >>> 
> >>> 
> >>> 
> >>> 
> >>> ;; - - - 
> >>> 
> >>> 
> >>> 
> >>> #lang s-exp "new-lang.rkt” ;; new-lang-client.rkt 
> >>> 
> >>> 
> >>> ((lambda (x) x)
> >>> (lambda (y) y))
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> On May 23, 2017, at 10:03 PM, Vityou  wrote:
> >>> 
> >>> 
> >>> On Tuesday, May 23, 2017 at 7:17:18 PM UTC-6, Matthias Felleisen 
> >>> wrote:
> >>> Why do you interpret S-expressions instead of re-mapping lambda and 
> >>> #%app? 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> 
> >>> On May 23, 2017, at 9:14 PM, Vityou  wrote:
> >>> 
> >>> I might be able to do something like this, but what I'm looking for 
> >>> is something that will be able to show the variables available to it 
> >>> in adition to its source.  I'll probable have to do something like 
> >>> what you did with the struct accept add a field with its available 
> >>> variables and modify #%app to add to its known variables.
> >>> 
> >>> -- 
> >>> 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.
> >>> For more options, visit 

Re: [racket-users] How to pretty print HTML?

2017-05-28 Thread Matthias Felleisen

> On May 28, 2017, at 7:37 PM, Zelphir Kaltstahl  
> wrote:
> 
>  did not know about `with-output-to-string` - This means I can get any output 
> of a procedure, which usually prints that right away, into a string, I guess.


Makes for really good unit testing for I/O too. 

-- 
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] How to pretty print HTML?

2017-05-28 Thread Zelphir Kaltstahl
On Sunday, May 28, 2017 at 10:20:10 PM UTC+2, Matthias Felleisen wrote:
> I have the impression that you are conflating rendering as an output with 
> representing as a string. So the following code tries to sketch this: 
> 
> (require xml)
> 
> ;; Xexpr -> String 
> (define (xexpr->xml/pretty x) 
>   (with-output-to-string
>(lambda ()
>  (display-xml/content
>   (xexpr->xml x)
> 
> (define x
>   `(html
> (body ((bgcolor "red"))
>   "Hi!" (br) "Bye!")))
> 
> (xexpr->xml/pretty x) ;; turn XML into string with newlines and indentation 
> and all — but see how the IDE renders it in the REPL 
> 
> (displayln (xexpr->xml/pretty x)) ;; print the same string — now the IDE is 
> forced to render the printed output 
> 
> — Matthias
> 
> 
> 
> 
> > On May 28, 2017, at 7:55 AM, Zelphir Kaltstahl  
> > wrote:
> > 
> > I have some HTML code, which I generate using x-expressions:
> > 
> > (string-append DOCTYPE-HTML5
> >   "\n"
> >   (xexpr->string
> >`(html
> >  (body ((bgcolor "red"))
> >"Hi!" (br) "Bye!"
> > 
> > I don't like how the result looks in the source code of the web page 
> > created in this way. I'd like there to be indentation and line breaks, 
> > according to the nesting of the DOM elements.
> > 
> > So far I've found the following links and information:
> > 
> > - https://docs.racket-lang.org/reference/pretty-print.html (I don't know 
> > how to use it, because it has no examples. It also seems more like a 
> > library, which generically can pretty print anything you want, provided you 
> > "configure" is correctly. However, HTML is quite complex, I think, so I'd 
> > not like to rewrite something that already exists elsewhere.)
> > - https://docs.racket-lang.org/xml/ (Here are some mentions of indentation 
> > and newlines, but I need some procedure, which returns it, not displays it 
> > immediately and then "does not let me have it", or is there a way to 
> > somehow redirect output into a value which I can use? For example 
> > `display-xml` seems to do what I need. :)
> > 
> > Ideal might be a keyword parameter for `xexpr->string`, which specifies 
> > whether it should prettify the string or not, but such a thing does not 
> > exist according to the docs.
> > 
> > How can I prettify my HTML output?
> > 
> > (I really don't care about a few bytes more data needing to be sent. This 
> > is not the next Google.)
> > 
> > -- 
> > 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.

Perfect! Does exactly what I wanted.

It is only that I care how it looks when I open the source code view of a web 
page and all the HTML was on one super long line. I know it does not make a 
difference for how the browser renders things, but it is somewhat annoying for 
myself to know that it is not properly indented etc. in the source of the HTML 
page.

I did not know about `with-output-to-string` - This means I can get any output 
of a procedure, which usually prints that right away, into a string, I guess.

Thanks for your help.

-- 
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] Racket for Kids in 2017

2017-05-28 Thread ylluminate
Some really good thoughts there.  I think key is to have some initial 
structured content to give him a springboard and then allow him to build out 
from there.  

LOL, yes, I agree wrt keeping web programmer (specifically JS) influences away 
to avoid brain rot! :D  Even though my older son started with JS, he was able 
to have some serious balance to his understanding with my CS background which 
ultimately helped him to really go down the proper paths and to see things as 
they really are.  Worlds of help (and yeah, the 80's methodology of hack it 
until you crack it really helps).  One reason I throw Unix systems at them 
initially so that they can start learning that the shell is a useful thing... :)


On Sunday, May 28, 2017 at 2:06:55 AM UTC-4, Neil Van Dyke wrote:
> Have you looked at HtDP?  I'm guessing it's still too "old" for any 10yo 
> (you might have to wait until 12, at least), but worth a look, so you 
> have some sense when to introduce it later.
> 
> One option is to make this constructionist self-directed, with a 
> helper.  Specifically, find out something he wants to start making or 
> doing first, and have older brother give him pointers on how to get 
> started.  For example, if he wants to start playing with graphics, older 
> brother can show him how to minimally operate DrRacket, an example of 
> graphics, how to modify it, and where's some documentation for doing 
> other things with graphics.  Then brother is available occasionally for 
> questions and tips (say, he wants to draw a car, and this car has 2 
> wheels, and brother might show him how do abstract that into a 
> `draw-wheel` procedure, even though the kid has probably not yet been 
> exposed to any algebra (he doesn't have to understand variables, to 
> start modifying an example, and incidentally starting to learn some 
> algebra without being explicitly told about it).  And lots of unattended 
> time to figure things out and play on his own.
> 
> Similar with animations, music, games.
> 
> Maybe get a friend or two of the same age also learning this way, so 
> they can learn from and inspire each other, work on things together, 
> etc.  But be careful that all of them stay encouraged, and you don't get 
> a situation like one of them getting a head start and consequently 
> feeling like they're "good at this", and the other feeling like they're 
> "bad at this", which are self-fulfilling perceptions.
> 
> There are also language platforms specifically designed for young 
> children.  But don't discount the potential of throwing a young child at 
> a computer with only non-child software on it, and let them figure out 
> how to do what they want, much on their own.  That's how the early-1980s 
> home computer kids got started, and that worked out pretty well.  Just 
> keep nudging towards increasing technical sophistication, as the child 
> is ready.  (And keep child away from modern Web programmer talk as long 
> as possible, to avoid rotting brain during a crucial formative period. :)

-- 
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] Racket for Kids in 2017

2017-05-28 Thread Matthias Felleisen




> On May 28, 2017, at 6:24 PM, ylluminate  wrote:
> 
> Matthias, thanks for that. So essentially the scripted components are 
> available in different focuses (e.g., HoC, Algebra, Reactive, Data Science, & 
> Physics) here:
> http://www.wescheme.org/openEditor
> 
> Correct?  Are these to be used in a stepwise fashion moving from HoC to 
> Algebra to Reactive, etc? 

Yes. 

> 
> It seems that after these are completed, you then recommend the "After 
> Bootstrap" links.

Yes! 



> 
> 
> 
> On Sunday, May 28, 2017 at 4:28:33 PM UTC-4, Matthias Felleisen wrote:
>> On May 28, 2017, at 1:23 AM, ylluminate  wrote:
>> 
>> 
>> I have a older teen who's been programming for the last several years and is 
>> remarkably talented.  His younger brother is now wanting to get going (10).
>> 
>> My older son started with JS, learned how to hate it, and moved on to Ruby 
>> (specifically Opal has a special place in his heart as far as isomorphic dev 
>> goes).  From there he's worked with a number of other languages, including 
>> Racket.  The nice thing about JS at the time was that he used Codecademy 
>> with their rapid turn around repl + visual results.  After a good bit of 
>> discussion, it really seems that Racket mostly matches this need and 
>> provides an even superior foothold for one just starting.
>> 
>> Initially I really thought that "Realm of Racket" would be an ideal 
>> springboard for him, but some reviews have made me think otherwise.
>> 
>> Does anyone have a solid recommendation for starting kids off with Racket in 
>> 2017?  Are there any kid-centric courses?
>> 
>> 
>> 
>> 
>> 
>> 
>> You should check into bootstrap-world.org. It is the middle school part of 
>> our outreach project. It comes with a scripted curriculum that introduces 
>> video programming via very simple Racket. See WeScheme.org for the IDE. The 
>> curriculum is a simplification and adaptation of How to Design Programs 
>> (HtDP) for kids in the 10-14 age range. You can also use DrRacket and its 
>> Beginning Student Language (BSL) if you wish to work off-line. If a package 
>> fails to meet the advertised standard, holler and we will fix it. (We 
>> occasionally diverge here.) [FWIW, this form of coding is isomorphic to the 
>> math kids learn at the same grade level. We dont tell them in case they 
>> don’t like math. So even if your teenager does not go on to become the next 
>> Facebook creator with his Racket skills, he will have learned and 
>> re-inforced a much more valuable skill.]
>> 
>> 
>> The second step could be Bootstrap II (but that’s in a different language) 
>> or HtDP or both, sequenced in this order. 
>> 
>> 
>> Realm of Racket is NOT intended for plain beginners. It says so in the 
>> Preface. We really tried hard to clarify that we assume some basic 
>> programming knowledge, such as HtDP or something else (not necessarily 
>> Racket). I don’t know which reviews you found but I sure hope they 
>> acknowledge that we already say it’s not intended for 10-year olds. 
>> 
>> 
>> — Matthias

-- 
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] Racket for Kids in 2017

2017-05-28 Thread ylluminate
Matthias, thanks for that. So essentially the scripted components are available 
in different focuses (e.g., HoC, Algebra, Reactive, Data Science, & Physics) 
here:
http://www.wescheme.org/openEditor

Correct?  Are these to be used in a stepwise fashion moving from HoC to Algebra 
to Reactive, etc? 

It seems that after these are completed, you then recommend the "After 
Bootstrap" links.



On Sunday, May 28, 2017 at 4:28:33 PM UTC-4, Matthias Felleisen wrote:
> On May 28, 2017, at 1:23 AM, ylluminate  wrote:
> 
> 
> I have a older teen who's been programming for the last several years and is 
> remarkably talented.  His younger brother is now wanting to get going (10).
> 
> My older son started with JS, learned how to hate it, and moved on to Ruby 
> (specifically Opal has a special place in his heart as far as isomorphic dev 
> goes).  From there he's worked with a number of other languages, including 
> Racket.  The nice thing about JS at the time was that he used Codecademy with 
> their rapid turn around repl + visual results.  After a good bit of 
> discussion, it really seems that Racket mostly matches this need and provides 
> an even superior foothold for one just starting.
> 
> Initially I really thought that "Realm of Racket" would be an ideal 
> springboard for him, but some reviews have made me think otherwise.
> 
> Does anyone have a solid recommendation for starting kids off with Racket in 
> 2017?  Are there any kid-centric courses?
> 
> 
> 
> 
> 
> 
> You should check into bootstrap-world.org. It is the middle school part of 
> our outreach project. It comes with a scripted curriculum that introduces 
> video programming via very simple Racket. See WeScheme.org for the IDE. The 
> curriculum is a simplification and adaptation of How to Design Programs 
> (HtDP) for kids in the 10-14 age range. You can also use DrRacket and its 
> Beginning Student Language (BSL) if you wish to work off-line. If a package 
> fails to meet the advertised standard, holler and we will fix it. (We 
> occasionally diverge here.) [FWIW, this form of coding is isomorphic to the 
> math kids learn at the same grade level. We dont tell them in case they don’t 
> like math. So even if your teenager does not go on to become the next 
> Facebook creator with his Racket skills, he will have learned and re-inforced 
> a much more valuable skill.]
> 
> 
> The second step could be Bootstrap II (but that’s in a different language) or 
> HtDP or both, sequenced in this order. 
> 
> 
> Realm of Racket is NOT intended for plain beginners. It says so in the 
> Preface. We really tried hard to clarify that we assume some basic 
> programming knowledge, such as HtDP or something else (not necessarily 
> Racket). I don’t know which reviews you found but I sure hope they 
> acknowledge that we already say it’s not intended for 10-year olds. 
> 
> 
> — Matthias

-- 
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] Racket for Kids in 2017

2017-05-28 Thread Matthias Felleisen

> On May 28, 2017, at 1:23 AM, ylluminate  wrote:
> 
> I have a older teen who's been programming for the last several years and is 
> remarkably talented.  His younger brother is now wanting to get going (10).
> 
> My older son started with JS, learned how to hate it, and moved on to Ruby 
> (specifically Opal has a special place in his heart as far as isomorphic dev 
> goes).  From there he's worked with a number of other languages, including 
> Racket.  The nice thing about JS at the time was that he used Codecademy with 
> their rapid turn around repl + visual results.  After a good bit of 
> discussion, it really seems that Racket mostly matches this need and provides 
> an even superior foothold for one just starting.
> 
> Initially I really thought that "Realm of Racket" would be an ideal 
> springboard for him, but some reviews have made me think otherwise.
> 
> Does anyone have a solid recommendation for starting kids off with Racket in 
> 2017?  Are there any kid-centric courses?



You should check into bootstrap-world.org . It is 
the middle school part of our outreach project. It comes with a scripted 
curriculum that introduces video programming via very simple Racket. See 
WeScheme.org  for the IDE. The curriculum is a 
simplification and adaptation of How to Design Programs (HtDP) for kids in the 
10-14 age range. You can also use DrRacket and its Beginning Student Language 
(BSL) if you wish to work off-line. If a package fails to meet the advertised 
standard, holler and we will fix it. (We occasionally diverge here.) [FWIW, 
this form of coding is isomorphic to the math kids learn at the same grade 
level. We dont tell them in case they don’t like math. So even if your teenager 
does not go on to become the next Facebook creator with his Racket skills, he 
will have learned and re-inforced a much more valuable skill.]

The second step could be Bootstrap II (but that’s in a different language) or 
HtDP or both, sequenced in this order. 

Realm of Racket is NOT intended for plain beginners. It says so in the Preface. 
We really tried hard to clarify that we assume some basic programming 
knowledge, such as HtDP or something else (not necessarily Racket). I don’t 
know which reviews you found but I sure hope they acknowledge that we already 
say it’s not intended for 10-year olds. 

— Matthias


-- 
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] How to pretty print HTML?

2017-05-28 Thread Matthias Felleisen

I have the impression that you are conflating rendering as an output with 
representing as a string. So the following code tries to sketch this: 

(require xml)

;; Xexpr -> String 
(define (xexpr->xml/pretty x) 
  (with-output-to-string
   (lambda ()
 (display-xml/content
  (xexpr->xml x)

(define x
  `(html
(body ((bgcolor "red"))
  "Hi!" (br) "Bye!")))

(xexpr->xml/pretty x) ;; turn XML into string with newlines and indentation and 
all — but see how the IDE renders it in the REPL 

(displayln (xexpr->xml/pretty x)) ;; print the same string — now the IDE is 
forced to render the printed output 

— Matthias




> On May 28, 2017, at 7:55 AM, Zelphir Kaltstahl  
> wrote:
> 
> I have some HTML code, which I generate using x-expressions:
> 
> (string-append DOCTYPE-HTML5
>   "\n"
>   (xexpr->string
>`(html
>  (body ((bgcolor "red"))
>"Hi!" (br) "Bye!"
> 
> I don't like how the result looks in the source code of the web page created 
> in this way. I'd like there to be indentation and line breaks, according to 
> the nesting of the DOM elements.
> 
> So far I've found the following links and information:
> 
> - https://docs.racket-lang.org/reference/pretty-print.html (I don't know how 
> to use it, because it has no examples. It also seems more like a library, 
> which generically can pretty print anything you want, provided you 
> "configure" is correctly. However, HTML is quite complex, I think, so I'd not 
> like to rewrite something that already exists elsewhere.)
> - https://docs.racket-lang.org/xml/ (Here are some mentions of indentation 
> and newlines, but I need some procedure, which returns it, not displays it 
> immediately and then "does not let me have it", or is there a way to somehow 
> redirect output into a value which I can use? For example `display-xml` seems 
> to do what I need. :)
> 
> Ideal might be a keyword parameter for `xexpr->string`, which specifies 
> whether it should prettify the string or not, but such a thing does not exist 
> according to the docs.
> 
> How can I prettify my HTML output?
> 
> (I really don't care about a few bytes more data needing to be sent. This is 
> not the next Google.)
> 
> -- 
> 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] Question: 2D data (Arrays?) in Universe Teachpack

2017-05-28 Thread Matthias Felleisen

> On May 27, 2017, at 10:00 AM, A Mauer-Oats  wrote:
> 
> This time we used math/array, but arrays are basically mutable in nature and 
> that doesn't seem to work very well with way the universe is set up. My 
> students ended up writing a lot of code like (begin (array-set! board ...) 
> board) without really understanding it. Some copied arrays far too much and 
> performance suffered, but I think that is a secondary concern.


Let me echo John’s and Jordan’s pieces of implicit pieces of advice.

--- It sounds to me like you want your students to go through a regular 
introductory version of HtDP, just up to lists of structs or list of lists 
(approx. Part II, half way). 
— Both ‘Battleship’ and ‘Checkers’ are ideal candidates to explain why you do 
NOT want grid-based data (they are naive) and to study something that goes 
beyond.
— If you’re willing to write a server, you can get the kids to run networked 
games. In my experience they love networked code, because it is close to their 
experience. 

Last fall, I ran our regular introductory course. After 3 weeks, the kids wrote 
their first chat client, including those who had never coded before. They used 
images as representations of sequences of received messages. Then we discussed 
why this was a bad idea. So when we got to lists, we switched to a list 
representation. We discussed abstraction boundaries and why API mattered — 
again, kids who never code before got two ideas: 

— why you want to code systematically (quickly find what you want to modify 
because the specs got modified) 
— why layering matters (modify only those things that matter because systematic 
design has isolated that point)

By the end, we send structures that represented emoticons, URLs, replaced them. 
blacklisted and whitelisted participants. The kids who minored really got what 
to look for when they try to work with developers in the real world — not code 
cowboys who know how to spell C. 

See https://course.ccs.neu.edu/cs2500f16/ 
 for details, especially syllabus and 
assignments. (Of course, I’d go slower in pre-college courses) 

— Matthias


-- 
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] making a language that can return the body of a function

2017-05-28 Thread Matthias Felleisen

You need to apply the function, not just compute the substitution. See 
applicable struct in previous message. This should just work out, w/o much ado. 



> On May 28, 2017, at 12:40 AM, Vityou  wrote:
> 
> On Thursday, May 25, 2017 at 5:50:29 PM UTC-6, Matthias Felleisen wrote:
>> The client module can refer to all imported #% forms. If you don’t export it 
>> from the language module, it’s not there. [Well, mostly] Implicitly the 
>> client module already refers to #% forms already. 
>> 
>> 
>> 
>>> On May 25, 2017, at 7:09 PM, Vityou  wrote:
>>> 
>>> On Wednesday, May 24, 2017 at 2:05:23 PM UTC-6, Matthias Felleisen wrote:
 Don’t eval. This is a bit crude but it now your lam-s keep track of your 
 environment, too. 
 
 #lang racket ;; new-lang.rkt 
 
 (provide
 #%app
 #%datum
 #%top-interaction
 (rename-out
 (new-lambda lambda)
 (new-mb #%module-begin)))
 
 (require racket/stxparam)
 
 (define-syntax (new-lambda stx)
 (syntax-case stx ()
   [(_ (x ...) e ...)
#`(letrec ([L (lam '(x ...)
   '(e ...)
   (*env)
   (lambda (x ...)
 (syntax-parameterize ([*env
(lambda (stx)
  (syntax-case stx ()
[(_) #`(append '(x ...) 
 (lam-environment L))]))])
   e)
 ...))])
L)]))
 (define-syntax-parameter *env
 (syntax-rules () [(_) '()]))
 (struct lam (parameters bodies environment closure) #:property 
 prop:procedure 3)
 
 (define-syntax (new-mb stx)
 (syntax-case stx ()
   [(_ e ...)
#'(#%module-begin
   (let ([v e])
 (if (lam? v)
 `(let (,@(map (lambda (x) `(,x --some-value--)) 
 (lam-environment v)))
(lambda ,(lam-parameters v) ,@(lam-bodies v)))
 v))
   ...)]))
 
 
 
> On May 24, 2017, at 3:41 PM, Vityou  wrote:
> 
> On Wednesday, May 24, 2017 at 12:05:19 PM UTC-6, Vityou wrote:
>> On Tuesday, May 23, 2017 at 8:21:59 PM UTC-6, Matthias Felleisen wrote:
>>> Try to start with this: 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> #lang racket ;; new-lang.rkt 
>>> 
>>> 
>>> (provide
>>> #%app
>>> #%datum
>>> #%top-interaction
>>> (rename-out
>>> (new-lambda lambda)
>>> (new-mb #%module-begin)))
>>> 
>>> 
>>> (define-syntax (new-lambda stx)
>>> (syntax-case stx ()
>>>   [(_ (x ...) e ...)
>>>#'(lam '(x ...) '(e ...) (lambda (x ...) e ...))]))
>>> 
>>> 
>>> (struct lam (parameters bodies closure) #:property prop:procedure 2)
>>> 
>>> 
>>> (define-syntax (new-mb stx)
>>> (syntax-case stx ()
>>>   [(_ e ...)
>>>#'(#%module-begin
>>>   (let ([v e])
>>> (if (lam? v)
>>> `(lambda ,(lam-parameters v) ,@(lam-bodies v))
>>> v))
>>>   ...)]))
>>> 
>>> 
>>> 
>>> 
>>> ;; - - - 
>>> 
>>> 
>>> 
>>> #lang s-exp "new-lang.rkt” ;; new-lang-client.rkt 
>>> 
>>> 
>>> ((lambda (x) x)
>>> (lambda (y) y))
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On May 23, 2017, at 10:03 PM, Vityou  wrote:
>>> 
>>> 
>>> On Tuesday, May 23, 2017 at 7:17:18 PM UTC-6, Matthias Felleisen wrote:
>>> Why do you interpret S-expressions instead of re-mapping lambda and 
>>> #%app? 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On May 23, 2017, at 9:14 PM, Vityou  wrote:
>>> 
>>> I might be able to do something like this, but what I'm looking for is 
>>> something that will be able to show the variables available to it in 
>>> adition to its source.  I'll probable have to do something like what 
>>> you did with the struct accept add a field with its available variables 
>>> and modify #%app to add to its known variables.
>>> 
>>> -- 
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>>> 
>>> I dont know what I could map lambda to that would let it retain and 
>>> print its known variables besides a list.
>> 
>> That's probably good enough for most cases, but I tried to add a struct 
>> field to record the lexical content, I can't fin a way to mimic 
>> evaluating the body of the function in the struct, this is the closest I