Joel Neely schreef op 16-2-2015 om 14:07:
I'm sorry, but I must disagree with the generalization.

You described "the very nature" of a typical recursion over a list:
(1) deal with the head, then
(2) deal with everything else.

But lists are not the only recursive structure. Infix-order processing of a tree, for example, is more naturally described as:
(1) deal with the left sub-tree (the first "everything else"),
(2) deal with the parent (analogous to the head of a list),
(3) deal with the right sub-tree (the second "everything else").

At the risk of a spoiler...

.

.

.

.

One approach to the Towers of Hanoi problem emerges nicely from thinking of the moves as a tree.


You did not spoil everything.

As I see it , it will be like this :

1) deal with peg a
2) deal with peg b
3) deal with peg c

I think this is workingt to a recursive solution.

Roelof