[Haskell-cafe] Haskell's currying and partial application
bf3 at telenet.be
Tue Jul 3 08:21:27 EDT 2007
Duh, I made a typo in my previous emails, I did mean a -> (b -> c) and not a -> (b,c). But you guys quickly corrected that
IMHO when reading
a newbie like me cannot see the difference between currying and partial application...
I quote the text:
"Currying is the process of transforming a function that takes multiple arguments into a function that takes just a single argument and returns another function if any arguments are still needed. In Haskell, all functions are considered curried: that is, all functions in Haskell take just single arguments.
This is mostly hidden in notation, and so may not be apparent to a new Haskeller. Let's take the function
div :: Int -> Int -> Int
which performs integer division. The expression div 11 2 unsurprisingly evaluates to 5. But there's more that's going on than immediately meets the untrained eye. It's a two-part process. First,
is evaluated and returns a function of type
Int -> Int"
But that is partial application, not currying no... Later in the text tuples are mentioned, but the real definition of currying being
-- Hope I get it right this time...
curry :: ((a, b) -> c) -> a -> b -> c
is not really clear from the article to me...
>----- Oorspronkelijk bericht -----
>Van: Henning Thielemann [mailto:lemming at henning-thielemann.de]
>Verzonden: dinsdag, juli 3, 2007 01:48 PM
>Aan: 'Peter Verswyvelen'
>CC: Haskell-Cafe at haskell.org
>Onderwerp: Re: [Haskell-cafe] Haskell's currying and partial application
>On Tue, 3 Jul 2007, Peter Verswyvelen wrote:
>> Ah, thanks for the correction. So if I understand it correctly, this is currying:
>and more generally:
More information about the Haskell-Cafe