Curricula (was: Assembly vs. Everything Else

From: Fred Cisin <cisin_at_xenosoft.com>
Date: Mon Aug 20 11:17:57 2001

On Mon, 20 Aug 2001, Jeffrey S. Sharp wrote:
> On the other hand, they're not that bad. I like Lisp-like languages.
> (0) Prefix notation throughout the language is nicely consistent.
> (1) Little or no need for precedence rules is somewhat nice.
> (2) Proper indentation and editor can alleviate paren hell.
> I guess those reasons don't really seem tera-compelling. To each, his
> own.

They're pretty good.
I would like my students to understand the concepts of precedence rules,
but I would rather see a program use parentheses than to rely on the
precedence rules.


> > Encouraged? Some of the teachers won't let their students do a
> > program to count to 10 WITHOUT recursion! They can't imagine doing
> > something like Fibonacci sequence WITHOUT using recursion.
> Those teachers are probably of the mathy kind. Either their imagination
> is limited to recursion, or they think they're being much less deceptive
> by using recursion instead of the special cases of it rolled into a
> particular language's looping constructs. Either way, it's just going to
> be confusing to new students.

"To the man who has a hammer, the whole world looks like a nail." I have
seen SEVERAL products of that system who sincerely believed that ANYTHING
that COULD be done with recursion SHOULD be done with recursion, including
simple FOR loops. I consider recursion to be a clever/cute/curiousity,
not the fundamental basis for a programming model.


> > How can you do a non-trivial program with recursion without stack
> > overflow?
> Very carefully, but it can happen.

The canonical example for explaining recursion is factorial. In anything
resembling real world, a FOR loop works better.
I've used recursion for "walking the tree" of a subdirectory
structure. It was fun and easy, but the stack load was excessive.
I eventually switched to a linked list of subdirectories with a pointer of
which dirs were done chasing a pointer of new dirs being added.
In order for recursion to be stable, one would want more than a 64K
segment for stack.


> > while(*T++=*S++);
> Was this an actual program fragment?

Yes.
It's how C copies a string. The character at the location pointed to by
the S pointer is copied to the location pointed to by the T pointer, both
pointers are incremented, and it continues until the character that was
copied had a value of zero (C uses null-termination to mark the end of
strings).

--
Grumpy Ol' Fred        cisin_at_xenosoft.com
Received on Mon Aug 20 2001 - 11:17:57 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:33 BST