[Haskell-cafe] Re: What is the role of $!?

apfelmus apfelmus at quantentunnel.de
Sun Nov 18 11:50:28 EST 2007


Paul Johnson wrote:
> Andrew Coppin wrote:
>>
>> PS. There is a technical distinction between the terms "lazy" and 
>> "non-strict", and also the opposite terms "eger" and "strict". I 
>> couldn't tell you what that is.
>
> As I understand it, the distinction is between the mathematical term 
> "non-strict" and the implementation method of "lazy".  "Non-strict" 
> means that "reduction" (the mathematical term for evaluation) proceeds 
> from the outside in, so if I have (a+(b*c)) then first you reduce the 
> "+", then you reduce the inner (b*c).  Strict languages work the other 
> way around, starting with the innermost brackets and working outwards.
> [...]

Almost right, but strict and non-strict aren't tied to an operational 
semantics. In other words, you can talk about _|_ and strictness without 
knowing how to evaluate your expressions at all. See also

   http://en.wikibooks.org/wiki/Haskell/Denotational_semantics .

For more on the details of lazy evaluation (which actually does work 
"outside in"), there's the incomplete

   http://en.wikibooks.org/wiki/Haskell/Graph_reduction .

Of course, strict and eager as well as non-strict and lazy have pretty 
much the same effect and can be used synonymously, but they're different 
things nonetheless.


Regards,
apfelmus



More information about the Haskell-Cafe mailing list