Who would have thunk it?

I recently read this article about Lazy Computation in C#. What the article discusses is creating lazy evaluation in C#. 

Lazy evaluation is a key feature of functional languages like Haskell but is not common in imperative languages.  It is used in Haskell because it implements parameter passing on a call by need basis.  What this means is that a functions arguments are not executed until they are used but once used the argument retains its calculated value.  This is good because it prevents wasted computation since if a argument isn't used it isn't executed.

The article goes into details about how to create lazily evaluated arguments and why they are useful.


Now, I don't know if anyone else found this posts title funny but I did because a lazily evaluated argument used in Haskell and that the article shows how to create is commonly referred to as a Thunk.  🙂

Skip to main content