[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: gnetlist/Scheme tutorial



On Jul 21, 2009, at 2:10 PM, Peter TB Brett wrote:

> On Tuesday 21 July 2009 18:45:55 John Doty wrote:
>> Here, as promised, is the text of the first installment of my
>> tutorial. Text only, I still gotta figure out the wiki. Comments are
>> welcome.
>
> I would teach people the:
>
> (define (add1 x)
>   (+ x 1))
>
> Syntax for function definition before introducing lambda properly  
> later.

I deliberately did it the other way, because I think it's easier to  
read. To recognize the shorthand above as a procedure definition, you  
have to notice the parentheses, which are the hardest thing to see  
because there are always so many of them. But "(lambda" screams  
"procedure". And later, when the learner needs to slip local  
parameters into a loop ("closure"), "(map (lambda ..." will already  
be using familiar building blocks.

One could wish that McCarthy had chosen better names for primitives.  
"procedure, first, rest" rather than "lambda, car, cdr". But that's  
why I said:

When you see "lambda" think "procedure".

>
> Cheers,
>
>                                  Peter
>
> -- 
> Peter Brett <peter@xxxxxxxxxxxxx>
> Remote Sensing Research Group
> Surrey Space Centre
>
>
>
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

John Doty              Noqsi Aerospace, Ltd.
http://www.noqsi.com/
jpd@xxxxxxxxx




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user