Towers of Hanoi: Difference between revisions

m
→‎{{header|AppleScript}}: (normalised argument order of map to map :: (a -> b) -> [a] -> [b] )
m (→‎{{header|AppleScript}}: (normalised argument order of map to map :: (a -> b) -> [a] -> [b] ))
Line 211:
end hanoi</lang>
 
 
Alternatively,Or to dispensedispensing with a mutating global variable, we could write:
and using a higher-order map function, we could write:
 
<lang applescript>on run
map(arrows, hanoi(3, "left", "right", "mid"), arrows)
-- {"left -> right", "left -> mid", "right -> mid",
Line 240 ⟶ 242:
 
-- LIBRARY FUNCTION
-- [a]map ->:: (a -> b) -> [a] -> [b]
on map(xsf, fxs)
script mf
property lambda : f
9,659

edits