[Edu-sig] Lisp vs Scheme vs Python

Matthias Felleisen matthias@rice.edu
Sat, 26 May 2001 10:17:18 -0500 (CDT)


Kirby writes: 
  I did study the Lisp example for awhile.  I'm always awed by LISP
  and all that tail recursion.  Yet the LISP _does_ have looping 
  syntax in the versions I've seen.  It's Scheme that stays purist
  about using only recursion for looping, no?

Lisp is _not_ tail-call optimizing by standard, and indeed, I don't know
of a Lisp implementation that performs tail-call optimizations.

Scheme is tail-call optimizing by standard, though there are
implementations that break tail-call optimizations.

As a result, there is no _need_ for looping constructs in Scheme yet there
is a need for such beasts in Lisp. In that reagrad, Lisp and Python are
quite similar. Of course, "need" does not imply that Scheme doesn't provide
a looping construct. As a matter of fact, the language includes a do macro
for just that purpose. 

The problem with forcing looping constructs is that they force programmers
to produce code whose structures doesn't match the structure of the data. 

If you look at the definition of NAT, you see linear induction. A linear
recursion in code matches this definition. If you look at the definition of
LIST you see ... and so on. Python and Lisp fail programmers in that
regard. With Python and Lisp you must teach kids "look at this example,
modify it, follow my suggestions" and hope that it eventually clicks. 

Of course, the interactive nature of Lisp's evaluator (since 1958?) and of
Python's interactive REPL (uh, IDLE, since 1995?) help students explore
quickly and absorb these micro patterns. Still, in the end if they are
confronted with an unusual data class, they fail to come up with code. 
I tested dozens and hundreds of students on that. They all had
introductions in Pascal or C (min 1 year) and couldn't write a function
that traversed a non-standard data class if their life depended on it. 

-- Matthias

Matthias Felleisen
Professor of Computer Science
Northeastern University, Boston
Rice University, Houston 

For a new way to look at the world of high school computing, 
see 

 http://www.teach-scheme.org/
 http://www.htdp.org/

"Computer Science is no more about computers than astronomy is 
 about telescopes."	
                                             -- E. W. Dijkstra