18/08/28 16:58:59.85 tep78gti.net
let rec hanoi(n,a,b,c) = if n=1 then print_string("move "^string_of_int(n)^" from "^a^" to "^c^"\n")
else begin
hanoi(n-1,a,c,b);
print_string("move "^string_of_int(n)^" from "^a^" to "^c^"\n");
hanoi(n-1,b,a,c);
end;;
let() = hanoi(int_of_string Sys.argv.(1),Sys.argv.(2),Sys.argv.(3),Sys.argv.(4));;
(* Note ; not ;; between begin and end, begin and end can be ( and ).
to compile
ocamlc.opt -o hanoi.exe hanoi.ml
to execute
hanoi 5 A B C
*)