706
|
1 |
// towers of hanoi in Fun
|
|
2 |
|
790
|
3 |
def hanoi(n, a, b, c) =
|
|
4 |
if n != 0 then {
|
706
|
5 |
hanoi (n - 1) a c b;
|
|
6 |
print_endline ("Move disk from pole " ^ (show a) ^ " to pole " ^ (show b));
|
|
7 |
hanoi (n - 1) c b a
|
790
|
8 |
} else write("")
|
706
|
9 |
|
|
10 |
impure $ hanoi 4 1 2 3;; |