
Am Mittwoch, 27. August 2008 13:54 schrieb Rafael Gustavo da Cunha Pereira Pinto:
Hi folks!
Since I don't have a CS degree, there are some concepts I don't fully understand, and I'd like to propose a "begginers" thread to discuss some of those topics.
For starters, what does a WHNF (weak-head normal form) mean?
Cheers, -- Rafael Gustavo da Cunha Pereira Pinto Electronic Engineer, MSc.
You can find a definition at http://burks.bton.ac.uk/burks/foldoc/53/126.htm It's not entirely helpful if you don't know some lambda-calculus. I don't have a CS degree either, so someone please correct me if I'm wrong (or confirm if I'm right). In Haskell, reducing a term to whnf (which e.g. seq is for) means evaluating it far enough that its top level constructor is known (or it's found to be bottom). For some types like Int, that means complete evaluation, for others it's far less. A list is in whnf if you know whether it's bottom, [] or h:t, where you might or might not know something about h and t. A Maybe term is in whnf if you know if it's bottom, Nothing or Just whatever. A function is in whnf if you know if it's bottom or \x -> rhs. HTH, Daniel