[Haskell-beginners] A post about Currying and Partial application

Peter Hall peter.hall at memorphic.com
Sat Oct 1 11:49:31 CEST 2011


I think this sentence isn't right:

"Curried functions are functions that only take one parameter."

The way I understand it, a non-curried function takes only one
parameter. Currying is syntactic sugar so you don't have to use
higher-order functions every time you want multiple parameters.

Without currying, if you wanted a function like:

    f a b c = 2 * a + b - c

, you'd have to write it something like:

  f a = f1
      where f1 b = f2
          where f2 c = 2 * a + b - c

or

   f a = (\b -> (\c ->  2*a + b -c))


Peter


On Fri, Sep 30, 2011 at 2:59 PM, Petar Radosevic <petar at wunki.org> wrote:
> Hi,
>
> Like most here I'm also learning the beautiful language called Haskell
> and arrived at the subject of Currying. To see if I really understood
> the concept, I decided to write a blog post about it.
>
> http://s3.wunki.org/posts/2011-09-30-curry-and-its-partial-application.html
>
> I hope it helps some of the beginners here. Please take a look at it
> and let me know if I'm wrong or if I missed something.
>
> Thank you!
> --
> Petar Radošević, Programmer
> wunki.org | @wunki
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



More information about the Beginners mailing list