Talk:Haskell/More on functions
From Wikibooks, the open-content textbooks collection
Thanks for the explanation of scoping for let versus where. However we haven't explained guards yet. I think the best thing is to add them to the section on function definitions.
Paul.
let vs. where
You say that (and i quote): The difference between "let" and "where" lies in the fact that "let foo = 5 in foo + foo" is an expression, but "foo + foo where foo = 5" is not. (Try it: an interpreter will gladly spit out the latter "expression".)
However, in Hugs (windows Nov. 2003 build, Haskell98 mode), " foo + foo where foo = 5 " (without quotes) evaluates just as well as the let version. Perhaps I misunderstood what you were saying?
Hmmm. GHCi rejects it. It may be that Hugs has a different way of turning typed expressions into something evaluatable which lets this through. I'll have to take out the "try it in an interpreter" bit.
[edit] Eq a =>
In Infix versus Prefix, "Eq a =>" is used for the first time but not explained.