[BULK] [plt-scheme] Teaching Scheme

From: Samuel Williams (space.ship.traveller at gmail.com)
Date: Mon May 3 09:14:25 EDT 2010

Dear Stephen,

I am highly appreciative of the implementations you've provided. Are you happy for me to add your name on the credits page?

Yes, it is a highly artificial problem - chosen specifically so that the advanced students might figure this out and have a bit of a laugh.

Kind regards,
Samuel

On 4/05/2010, at 1:01 AM, Stephen Bloch wrote:

> 
> On May 3, 2010, at 8:17 AM, Samuel Williams wrote:
> 
>> I'm putting together a website aimed at high school students and teachers, and would like to make sure the following page is as good as possible:
>> 
>> 	http://programming.dojo.net.nz/languages/scheme/index
>> 
>> In particular, "Why would I learn this language?" section needs to have a few paragraphs. I don't use Scheme so I hoped that you could provide the main reasons why Scheme is a language someone would want to learn about.
> 
> Take a look at http://wwwadelphi.edu/sbloch/class/tsrj/testimonials/
> 
>> It would also be great if someone could rewrite the Scheme source code example so that it is as close as possible to the C implementation:
>> 
>> 	http://programming.dojo.net.nz/languages/c/index
>> 
>> I understand that Scheme is very different from C, and uses different paradigms, so it doesn't have to be identical, however it would be great if it worked in generally the same way. It would be great if you could include comments explaining how it works and what is happening (like the C example).
> 
> Well, that particular algorithm relies very heavily on mutation, but here's a functional version.
> 
> (define (door-open door)
>   (doh door 99))
> 
> (define (doh door pass)
>   (cond [(zero? pass) true]
>         [(= (remainder door (+ pass 1)) pass)
>          (not (doh door (- pass 1)))]
>         [else
>          (doh door (- pass 1))]))
> 
> (define doors (build-list 100 door-open))
> 
> 
> 
> Somewhat shorter but more cryptic:
> 
> (define (door-open door)
>   (doh door 99))
> 
> (define (doh door pass)
>   (or (zero? pass)
>       (not (boolean=? (= (remainder door (+ pass 1)) pass)
>                       (doh door (- pass 1))))))
> 
> (define doors (build-list 100 door-open))
> 
> 
> 
> Even shorter, but takes some math (and illustrates how artificial this problem is :-) :
> 
> (define (door-open door)
>    (integer? (sqrt (+ door 1))))
> 
> (define doors (build-list 100 door-open))
> 
> 
> 
> Stephen Bloch
> sbloch at adelphi.edu
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100504/a92d418f/attachment.html>

Posted on the users mailing list.