
On Apr 3, 2008, at 13:13 , PR Stanley wrote:
Hi folks
let f = sum.map (^2).filter even f [1..4] 20
So far so good!
sum.map (^2).filter even [1..4] returns an error.
How is it that the composition above as part of a function equation doesn't return any errors while on its own it requires parentheses?
You seem to have expression evaluation confused with cpp/m4 macros. The `f' in `f [1..4]' is not expanded as text to `sum.map (^2).filter even [1..4]'; it is evaluated as a function whose definition will (when needed! lazy language) eventually turn out to be `sum.map (^2).filter even'. If you really must view it as a text macro substitution, then imagine that every macro expansion has a set of parentheses added around it. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH