progs/fun-tests/hanoi.fun
changeset 742 155426396b5f
parent 706 7d85a4599549
child 790 71ef7d9ef635
equal deleted inserted replaced
741:6512884e03b4 742:155426396b5f
       
     1 // towers of hanoi in Fun
       
     2 
       
     3 let rec hanoi = fun n a b c ->
       
     4   if n != 0 then (
       
     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
       
     8   ) else ();;
       
     9 
       
    10 impure $ hanoi 4 1 2 3;;