[Haskell-beginners] Re: foldl' vs seq

Ertugrul Soeylemez es at ertes.de
Tue Feb 2 08:05:23 EST 2010


Gabi <bugspynet at gmail.com> wrote:

> Thank you Ertugrul,
>
> I think I got it now.
> My lesson here is to avoid recursion as much possible and use foldr'
> instead.There are too many pitfalls.

That's not what I wanted to say.  It's good to understand recursion and
non-strict semantics, so that you can use them together to write great
programs. =)

However, as soon as you start speaking Haskell fluently, you won't write
out many recursions explicitly anymore.  For most things there are
combinators of some type, which you can use to express what you want.

Finally you will like monads, because most programming patterns can be
expressed conveniently in terms of them.  That includes stateful
computation, aborting, resuming, undoing, nondeterminism, failability,
probabilistic computation and an arbitrary mixture of them.


Greets
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/




More information about the Beginners mailing list