[Haskell-cafe] Closures and pointfree functions
Derek Elkins
derek.a.elkins at gmail.com
Mon Sep 3 13:53:46 EDT 2007
On Mon, 2007-09-03 at 19:47 +0200, Lars Oppermann wrote:
> Dear all,
>
> In the Haskell Wiki at http://www.haskell.org/haskellwiki/Closure
> there is an example for a function returning a closure given as
> f x = (\y -> x + y)
>
> Another way to achieve the same effect would be to write
> f' x = (+) x
>
> which to me as a beginner looks somewhat like pointfree style.
>
> Would f' be considered to return a closure
Going backwards:
Yes.
The pointfree "solution" in this case would simply be f' = (+)
Note that f x = \y -> x + y is written that way for emphasis and is
identical to f x y = x + y
More information about the Haskell-Cafe
mailing list