[Haskell-beginners] nested guards (Stephen Tetley)

Thomas Engel thomas.engel1 at gmx.net
Sat Feb 4 19:34:30 CET 2012

> > 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

More information about the Beginners mailing list