# [plt-scheme] Why do layman programmers care about Currying?

 From: Anthony Cowley (acowley at seas.upenn.edu) Date: Wed Dec 31 19:11:24 EST 2008 Previous message: [plt-scheme] Why do layman programmers care about Currying? Next message: [plt-scheme] Why do layman programmers care about Currying? Messages sorted by: [date] [thread] [subject] [author]

```On Wed, Dec 31, 2008 at 12:44 AM, Richard Cleis <rcleis at me.com> wrote:
> However, I am not certain that Currying refers to reducing the arguments in
> any order.  I have the impression that Currying literally means reducing
> them in the order that they appear so that other functions may be written to
> take advantage of such strictness.  Freeform reduction of arguments is
> simply making use of closures.  No?
>
> rac

I've always found the ordering aspect mildly troubling. Currying
transforms (a x b) -> c into a -> b -> c, but is (a x b) the same as
(b x a)? Not normally for programmers, but if you justify Currying
with the logical argument that (a /\ b) -> c <=> a -> b -> c, and you
believe that conjunctions are commutative, then I'm not sure where
that leaves you since you have identified product types with
conjunctions. I think the safe bet is to just call it partial
application and not have to worry about offending anyone :)

For practical purposes, functions of fewer arguments are more common,
so the flip function in Haskell's Prelude is commonly used when
exploiting one's automatically curried functions. For example,

Prelude> let f x y = x / y
Prelude> let g = flip f 3
Prelude> g 6
2.0

I don't think there is a flip automatically in scope in SML/NJ, but
it's a very handy function when working in this style as it handles
the case of functions of two arguments where the arguments are
"equally important." If your function takes more arguments, one
technique is to order them in terms of heavyness, or import, and put
the heavy ones first.

Anthony

```

 Posted on the users mailing list. Previous message: [plt-scheme] Why do layman programmers care about Currying? Next message: [plt-scheme] Why do layman programmers care about Currying? Messages sorted by: [date] [thread] [subject] [author]