Towers of Hanoi: Difference between revisions

(Updated the iterative D version)
Line 430:
Move disk 1 from the left pole to the right pole
</pre>
 
=={{header|F#}}==
<lang fsharp>let rec hanoi num start finish =
match num with
| 0 -> [ ]
| _ -> let temp = (6 - start - finish)
(hanoi (num-1) start temp) @ [ start, finish ] @ (hanoi (num-1) temp finish)
 
[<EntryPoint>]
let main args =
(hanoi 4 1 2) |> List.iter (fun pair -> match pair with
| (a, b) -> printf "Move disc from %A to %A\n" a b)
0</lang>
 
=={{header|FALSE}}==
1,481

edits