Re: The Little Schemer
- From: "H." <hbe123@xxxxxxxxx>
- Date: 17 Jul 2006 14:29:43 -0700
I still don't follow though. Why do we give the left one
of a pair twice as much weight?
Just because that is how the author's described the pattern. They could
have described a pattern where the first elements are squared instead
of doubled, and then the resulting program would have implemented that.
As far as I can see, giving the left one twice as much weight is an
academic exercise with the goal of giving the reader more practice in
writing and understanding recursion.
Beyond that, I also fail to see how the problem statement:
"Can you write a function that counts the number of atoms
in align's arguments"
means anything other than count the atoms in the arguments
to align for /all the recursive calls/. "align's arguments" expresses
more than one argument belonging to align. Further, why do the
authors insist on conflating atoms and lists?
If I pass ((a b) c) to align, then there is only one atom
/in/ that argument. It is "c". "(a b)" is not an atom. It is a list.
Well actually, if I have the list '((a b) c), there are *no* atoms.
There is only one list. But '((a b) c) is an argument to a recursive
procedure, and one of the next recursive calls with this procedure is
with 'c, which is an atom. And further recursive calls are with 'a and
'b. So, eventually all three atoms are processed.
.
- References:
- The Little Schemer
- From: aegis
- Re: The Little Schemer
- From: H.
- Re: The Little Schemer
- From: aegis
- Re: The Little Schemer
- From: Marlene Miller
- Re: The Little Schemer
- From: aegis
- The Little Schemer
- Prev by Date: Re: The Little Schemer
- Next by Date: scheme vs jboss j2ee java
- Previous by thread: Re: The Little Schemer
- Next by thread: reference to undefined identifier: x
- Index(es):
Relevant Pages
|