## Curried Functions

### Curried Functions

All,

I get the sense that curried functions can be extremely useful for partial
computations. For example, as in the Paulson book,

fun infixApply x f y = f (x, y);
val reciprocal = infixApply 1.0 op/;
reciprocal 2.0;

-> val it = 0.5 : real

The infixApply function actually defines an entire class of functions. But I'd
like to see something more powerful that can be done with curried functions.

Does anyone have any killer example?

-Denis

### Curried Functions

It's such a fundamental concept that I don't think there is any 'killer
example'. Curry can simply be defined as 'curry f x = \y -> f x y'. Use it
wherever applicable.

Here's a few examples:
http://www.yqcomputer.com/ #head-5e481d64ce1e19a3618ff7c6a9aee9accc0f72e8

Mike

### Curried Functions

In article <GPJQe.148188\$ XXXX@XXXXX.COM >,

Uh, that is the identity function, modulo eta. You probably meant
'curry f x y = f (x, y)' (or, more explicitly,
'curry f = \x -> \y -> f (x,y)').

Lauri

Exactly. :)
Mike

### Curried Functions

don't know if if is a killer application, but whenever
I need similar function, I can write a general function
and then curry it.

let gen f par =
general computation
particular computation via f

let f1 =
particular computation 1
let f2 =
particular computation 2

let mypart1 = gen f1

let mypart2 = gen f2

bye
--
Gianluca Moro Visit http://www.yqcomputer.com/
XXXX@XXXXX.COM MyBlog http://www.yqcomputer.com/

### Curried Functions

Currying doesn't perform the partial evaluation you seem to be assuming
it will. Currying is only an argument passing technique. Partial
evaluation is a related but separate concern.

Check these URLs for more info:
http://www.yqcomputer.com/
http://www.yqcomputer.com/

Hope these help or are at least interesting.