
4 Feb
2012
4 Feb
'12
6:34 p.m.
http://www.haskell.org/haskellwiki/Case
That link shows how to write a select function that offers functionality similar to a switch statement in C. ?Then you could use guards for the top-level switching and the select function for the second level.
Yikes - that idiom is rather horrible, vis packing cases into a list so they can be consumed by a function.
To solve the problem, I'd seek a more "mathy" description of the algorithm i.e. one that doesn't use conditionals so heavily and work from that rather than translate existing code.
Hi Stephen, I have solved the problem. I have made four functions instead of one.
Thanks
Thomas