Talk:Towers of Hanoi: Difference between revisions

m
Line 27:
First off, note that this rephrasing has introduced two new names and has also replace anonymous recursion (<code>$:</code>) with non-anonymous recursion (<code>H</code>) -- it would be bad to have the recursion happen purely within thenPart without the conditional which was in the original definition of H.
 
But, wait, why does ''else'' come before ''then''? (For the same reason that 0 comes before 1.:) The primitive <code>@.</code> uses its right argument to come up with an index which is used to select from the code fragments on the left.
 
In this case, the right argument to <code>@.</code> is <code>*</code> which returns 0 for zero arguments and 1 for positive arguments. So the test, in essence is: is the right argument greater than zero?
6,962

edits