From: ········@acm.org
Subject: Re: Common Lisp and the Little Schemer
Date: 
Message-ID: <4IiH7.23492$Re4.3749679@news20.bellglobal.com>
······@hushmail.com writes:
> I'm now learning CL with PAIP after having read 'The Little Schemer' and 'The
> seasoned Schemer'. My Scheme background  is giving me some trouble, because of
> the differences in what is considered an atom and null/null?, especially when
> trying to apply the 'First Commandment' in CL.
> 
> For those who haven't read the Little Schemer, 'The first commandment' is a
> template for functions that work on lists. This is the original text:
> 
> 'When recurring on a list of atoms, lat, ask two questions about it: (null?
> lat) and else.[...]When recurring on a list of s-expressions, l, ask three
> questions about it: (null? l), (atom? (car l)) and else"
> 
> This pattern doesn't seem to be common in PAIP. Is this 'commandment'
> recommended in CL?  What's the ususal way of doing this in CL?
> 
> After going through the little schemer, those 'commandments' (function
> templates) are a bit 'hardwired' and are confusing me while trying to
> translate them into CL. Should I get rid of this Scheme bagage or is it still
> valid in CL?

The "baggage" is perfectly legitimate _when writing recursive code_.

The axioms are perfectly good for that, and if you're writing
recursive code in CL, TLS/TSS's axioms will work perfectly well.

The thing that you'll find in CL is that you are much less likely to
express algorithms using recursion, as there is a much richer set of
iterative control structures available than there are in Scheme.

Furthermore, you're much more likely to do implicit iteration via
functions like MAPCAR or DOLIST; when you do that, you don't need to
_care_ about implementing the control structures, which is what the
TLS/TSS axioms are about.
-- 
(concatenate 'string "cbbrowne" ·@acm.org")
http://www.ntlug.org/~cbbrowne/advocacy.html
As of next Monday, TRIX will be flushed in favor of VISI-CALC.
Please update your programs.