Towers of Hanoi: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 213: | Line 213: | ||
Alternatively, to dispense with a mutating global variable, we could write: |
Alternatively, to dispense with a mutating global variable, we could write: |
||
<lang applescript> |
<lang applescript>on run |
||
map(hanoi(3, "left", "right", "mid"), arrows) |
map(hanoi(3, "left", "right", "mid"), arrows) |
||
-- {"left -> right", "left -> mid", "right -> mid", |
|||
-- "left -> right", "mid -> left", "mid -> right", "left -> right"} |
|||
end run |
|||
-- n -> s -> s -> s -> [(s, s)] |
-- n -> s -> s -> s -> [(s, s)] |
||
Line 224: | Line 231: | ||
end if |
end if |
||
end hanoi |
end hanoi |
||
-- DISPLAY FUNCTION |
-- DISPLAY FUNCTION |