bf3 at telenet.be
Tue Jul 3 06:53:33 EDT 2007
Ah, thanks for the correction. So if I understand it correctly, this is currying:
f :: (a,b) -> c
g :: a -> (b,c)
is the curried form of f? So currying has to do with tuples?
And partial application is just leaving away some tail arguments?
>----- Oorspronkelijk bericht -----
>Van: Jules Bean [mailto:jules at jellybean.co.uk]
>Verzonden: dinsdag, juli 3, 2007 12:19 PM
>CC: Haskell-Cafe at haskell.org
>Onderwerp: Re: [Haskell-cafe] Haskell's "partial application" (not currying!) versus Business Objects Gem Cutter's "burning"
>> In Haskell, currying can only be done on the last (rightmost) function
>You are talking about partial application, not currying.
>> foo x y
>> can be curried as
>> foo x
>> but not as
>> foo ? y
>> where ? would be a “wilcard” for the x parameter.
>(\x -> foo x y)
>> This burning looks more general to me, but cannot be done using the
>> textual approach?
>Well, it can be done, but basically there are two issues:
>1. You need to demarquate the 'scope' of the ?. What 'lump' of
>expression is the partially evaluated part. An obvious way to do this is
>with parentheses, but you have to be careful.
>2. If you have more than one ?, you need to remember which is which.
>Think of nested expressions, nested ?s. What if you want to use the
>'same' ? more than once?
>The solution that haskell chooses to (2) is to 'label' the ?s with
>names. The solution to (1) is to mark the scope with a \, and the list
>of names bound:
>\x z -> foo (foo x y) z
More information about the Haskell-Cafe