[Haskell-beginners] Value access in lambda function
Brandon Allbery
allbery.b at gmail.com
Sat Dec 29 06:55:54 CET 2012
On Fri, Dec 28, 2012 at 10:57 PM, Divam <dfordivam at gmail.com> wrote:
> (This is, in fact, how partial function application works.) a is still in
> scope when b is defined, a and b are still in scope when c is defined.
>
> Brandon, I need to study this again, still dont understood how its related
> to partial function application.
>
A function of multiple arguments is actually a function of a single
argument which returns a function that takes the next argument, and so on.
Partial application therefore happens automatically.
> Brandon, This is quite strange thing, the functions can access the
> globally defined variables and therefore there output is dependent not just
> on inputs but on those variables too. This goes against the understanding
> of pure functions.
>
You may be using a different definition of "pure" than Haskell does; the
point of pure functions in Haskell is that they cannot *change* anything
outside of the function scope, not that they can't *see* anything.
> Also there may be another way to look at this - all the global variables
> are inputs to all the functions. I think this is how the haskell looks at
> this scenario.
>
There are no variables involved. "Variables" can vary; bindings are
immutable. This is key to purity.
--
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121229/133878a6/attachment-0001.htm>
More information about the Beginners
mailing list