This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scheme tutorial


> > Hmm... filter is usually what comes right after factorial.  I'm not 
> > sure I want to impose Scheme thinking on a person just because 
> > they want to do some Scheme programming.  Not that there's 
> > anything wrong with Schemely thought, just that it might be better 
> > to let them discover that on their own once they've got a good 
> > grasp on the basic aspects of the language itself.
> 
> I don't know that it's avoidable, though. A mostly direct translation
> of procedural code to scheme is really, really gross, and rarely works
> well. Since the fundamentals of scheme are based on, well, schemely
> thought, approaching it in other ways is like banging your head
> against a wall (and there's not much point in using scheme if you're
> going to do program perl; better to use perl, which can't get much
> grosser for methods of programming ;).

I guess I'm making a bit of a distinction between the Scheme 
philosophy and reasonably decent Scheme code.  If you iterate 
over a list by finding it's length and using list-ref to get each 
member, then you've done something bad.  So a tutorial probably 
shouldn't even tempt the beginner by letting on that list-ref exists 
until they've got a good grasp on better methods.  If I had ever 
TA'ed a class that taught Scheme I would probably know even 
worse things a naive programmer could do, but I haven't so I'm 
optimistic :-)

It's OK to write imperative code, even in cases where functional 
code is more elegant.  They don't have to appreciate the aesthetic 
of Scheme.  That will come.  And if it doesn't it will hardly help if I 
bash them over the head with it.  If they want the philosophy I can 
hardly do better than the Wizard book.  But it wouldn't be that hard 
to be more practical than the Wizard book...

> > Also, introductions to Scheme tend to emphasize recreating the 
> > basic Scheme functions.  I think this comes from the 
> > minimalist/mathematical backgrounds of many of the Scheme 
> > enthusiasts and the texts they right.  I'd like to have something that 
> > teaches them to do something that they couldn't have done 
> > otherwise.  
> 
> This isn't to say that it shouldn't include some actual interesting
> bits ;), but it's not a bad idea to show how powerful the basic
> primitives can be. A lot of what you can do with scheme is somewhat
> foreign to someone coming from more limited languages; however, if you
> don't show those bits, you don't have much reason to recommend scheme
> over those languages.

Certainly someone who learns Scheme should appreciate that the 
Scheme language designers are not more blessed than the mere 
programmer.  Anyone who comes from C, Basic, or Perl will 
probably find this surprising and empowering.

> > Does a newbie need to understand continuations?  They don't 
> > seem to show up all that often in practical programming.  I didn't 
> > understand continuations until recently, and I'm still not sure if I 
> > understand them completely.  But I get by okay.
> 
> I was just thinking of the absolute hardest thing to find information
> on when you start programming scheme. Again, you don't need it, but
> it's at least nice to know it exists, and even better if you have a
> place where you can look to find an explaination when you do need it. 

I think Guile (and perhaps Scheme as a whole) would be well 
served by a bunch of essays on little topics like this.  Fluids, 
guardians, continuations, those memoizing macros... there's a 
number of small topics like that.

Also, those essays wouldn't be as useful if there wasn't a way to 
figure out which of those helps you do what.  If you want to do 
fancy control structures you wouldn't naturally think "ah... I need to 
study continuations".


--
Ian Bicking <bickiia@earlham.edu>