To parade my ignorance... Something that's always puzzled me about Haskell
is when to do something on the left and when on the right of a function
definition. For example, there must be at least 4 ways of writing the factorial
function: pattern match; guard; if ... then ... else ...; list comprehension
+ fold

I can appreciate that the declunkification transformation simplifies a
common problem but the cost seems to be yet another way of writing a
for loop... Are there any style guidelines for when to use what?

Greg Michaelson



Reply via email to