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