Currying - Curry function

Konst Sushenko konsu@microsoft.com
Tue, 7 Aug 2001 15:58:01 -0700


to check whether I myself understand currying correctly:

currying is not partial application (as the example below seems to
suggest), it is conversion of a function in to a form where partial
application is possible.

so we can say that

 g =3D curry f

is a curried function.

right?

konst


: -----Original Message-----
: From: Ashley Yakeley [mailto:ashley@semantic.org]=20
: Sent: Tuesday, August 07, 2001 3:46 PM
: To: Mark Carroll; Haskell Cafe List
: Subject: Re: Currying - Curry function
:=20
:=20
: At 2001-08-07 14:20, Mark Carroll wrote:
:=20
: >> Is there an exemple of such a function in the Haskell language ?
: >
: >Most certainly. For instance, we can define:
: >
: >	f :: Integer -> Integer -> Integer
: >	f x y =3D x + y
: >
: >	g =3D f 1
:=20
: That's not really currying, is it? This is currying:
:=20
: f :: (Integer,Integer) -> Integer
: f (x,y) =3D x + y
:=20
: g :: Integer -> Integer
: g y =3D f (1,y)
:=20
: -- g is f with the first argument curried with 1.
:=20
: h :: Integer -> Integer
: h x =3D f (x,1)
:=20
: -- h is f with the second argument curried with 1.
:=20
: And these are the functions for the first of two arguments:
:=20
: curry :: ((a,b) -> c) -> (a -> b -> c)
: curry f a b =3D f (a,b)
:=20
: uncurry :: (a -> b -> c) -> ((a,b) -> c)
: uncurry f (a,b) =3D f a b
:=20
: ... so that we can define
: g =3D curry f 1
:=20
:=20
: --=20
: Ashley Yakeley, Seattle WA
:=20
:=20
: _______________________________________________
: Haskell-Cafe mailing list
: Haskell-Cafe@haskell.org=20
: http://www.haskell.org/mailman/listinfo/haskell-cafe
:=20