
14 Apr
2008
14 Apr
'08
2:41 p.m.
Hi
hanoi_shower [] = ... hanoi_shower ((a, b) : moves) = ...
or (preferably) with map
hanoi_shower moves = unlines (map show_move moves) where show_move (a, b) = ...
A nice list comprehension works wonders in these situations: hanoi_shower moves = unlines ["Move " ++ show a ++ " to " ++ show b ++ "." | (a,b) <- moves] I would personally remove the "." from the end, as its a list of commands, not sentences - but that is personal choice. I'd also use unwords, as its slightly shorter: hanoi_shower moves = unlines [unwords ["Move", show a, "to", show b] | (a,b) <- moves] Thanks Neil