progs/hanoi.fun
author Christian Urban <urbanc@in.tum.de>
Sun, 22 Mar 2020 14:21:33 +0000
changeset 715 3cba5753bd77
parent 706 7d85a4599549
permissions -rw-r--r--
started dotty files

// towers of hanoi in Fun

let rec hanoi = fun n a b c ->
  if n != 0 then (
    hanoi (n - 1) a c b;
    print_endline ("Move disk from pole " ^ (show a) ^ " to pole " ^ (show b));
    hanoi (n - 1) c b a
  ) else ();;

impure $ hanoi 4 1 2 3;;