
15 Jul
2013
15 Jul
'13
10:59 p.m.
I will suggest an analogy to a similar (but simpler) situation. Suppose you are adding up some numbers. foo = let { x = 3; y = 4; z = 5 } in x + y + z That pattern only works if you know in advance how many numbers you are going to add. Otherwise, you need a function that works on a whole list of numbers: sum = foldr (+) 0 So...the short answer to your question is: use recursion. The better answer is: use library functions that do the recursion for you. You might want to look at foldM: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Mon... -Karl