Re: The Little Schemer




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.

.



Relevant Pages

  • How much Scheme do I need to know before starting the Little Schemer?
    ... I am comfortable with C and to some extent C# but I would like to explore functional programming (and brushing up on recursion would not hurt). ... I have the Little Schemer book and am starting to go through it. ... It starts by referring to atoms, and my initial reaction is what the hell is an atom? ...
    (comp.lang.scheme)
  • Spam from johnreed
    ... because we feel our weight. ... All atoms fall at the same rate in a vacuum. ... feel the cumulative 'non'-uniform resistance of those atoms when we ... The 'universal 'attractive action is uniform on the non- ...
    (sci.logic)
  • Spam from johnreed
    ... because we feel our weight. ... All atoms fall at the same rate in a vacuum. ... feel the cumulative 'non'-uniform resistance of those atoms when we ... The 'universal 'attractive action is uniform on the non- ...
    (sci.physics)
  • Spam from johnreed
    ... because we feel our weight. ... All atoms fall at the same rate in a vacuum. ... feel the cumulative 'non'-uniform resistance of those atoms when we ... The 'universal 'attractive action is uniform on the non- ...
    (sci.physics.relativity)
  • Is Mass the Cumulative Resistance of Atoms?
    ... because we feel our weight. ... All atoms fall at the same rate in a vacuum. ... feel the cumulative 'non'-uniform resistance of those atoms when we ... The 'universal 'attractive action is uniform on the non- ...
    (sci.physics.research)