in reply to (jeffa) Re: permutation understanding
in thread permutation understanding
if ($food) { print "$food\n"; eat (substr($food,0,length($food)-1)); }
Yes recursion can be instructive, but be careful not to mismatch a conditional test with the logical intent of the test. Your test of true or false doesn't mesh with your logical intent of recursing based on the length of the string. Try eating the string "012345" and your recursion ends too early because a string can have a non-zero length and still be false.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (jeffa) Re: permutation understanding
by greywolf (Priest) on May 25, 2002 at 18:36 UTC | |
by Anonymous Monk on May 25, 2002 at 18:55 UTC | |
by theguvnor (Chaplain) on May 25, 2002 at 21:36 UTC | |
by Anonymous Monk on May 25, 2002 at 22:07 UTC |