Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?

Comment Re:LISP a bad choice as a starter language. (Score 2, Informative) 330

I agree that Python is a better beginning language than Lisp, but I think the book is pitched more as an introduction to Lisp (and functional programming) than as an introduction to programming. That said, I'd like to say a few words in defense of Lisp as a first language.

In my experience (having taught a number of courses that involve coding), beginning programmers love to write bad code. The path of least resistance for them is to write monolithic blocks of code with one-character variable names and zero documentation, and to perform tasks in a remarkably contrived way that reflects a resistance to thinking ahead, somehow managing to do in cubic time what the "obvious" (to me) approach would do in linear time. Python tolerates this--it's such an awesome language that it is often easy to get something done even in the presence of terrible habits and lazy thinking (e.g., its readability makes monolithic code manageable).

Lisp does not make it so easy to get away with being a bad programmer. Writing monolithic functions, for instance, is relatively hard work in Lisp; the programmer who attempts this is punished with parentheses, and soon finds that the path of least resistance involves many relatively short functions with well-defined purposes. In other words, Lisp requires a level of care and forethought that other languages don't. Pedagogically, this is a virtue (though it comes with the heavy drawback that beginners can easily get discouraged).

There are exceptions, certainly. For instance, the easiest way to compute the nth Fibonacci number in Lisp is naive recursion, resulting in exponential runtime. Less naive recursion allows linear time, but a beginner would have trouble with that. (And a mathematically inclined programmer can compute it in constant time, if you assume arithmetic operations take constant time.)

In my view, the only *bad choice* of a starting language is one that causes brain damage, such as BASIC. Python tolerates brain damage (since it accommodates almost any programming style), but is safe under proper supervision. Lisp avoids brain damage.

Comment Re:Only scratching the surface (Score 1) 359

To those saying that a+b+c != c+b+a is about noncommutativity rather than nonassociativity: if you look carefully, this is about nonassociativity. The left expression (typically) parses as (a+b)+c; the right expression parses as (c+b)+a. In the presence of commutativity, which we do have with f.p. arithmetic, this is saying (a+b)+c != a+(b+c), which is nonassociativity.

Slashdot Top Deals

To err is human, to moo bovine.