A currying function

David Nadlinger see at klickverbot.at
Thu Jun 21 13:56:25 PDT 2012


On Thursday, 21 June 2012 at 19:04:32 UTC, Philippe Sigaud wrote:
> As for Haskell. For example, with a range of ranges and you 
> want to
> take the first 100 elements of all subranges:
>
> alias Curry!take ctake;
>
> auto target = [[0,1,2,...], [...], ];
> auto first100s = map!(ctake(100))(target);

To me, it seems like what you want here conceptually is partial 
application – it just happens to be equivalent to currying 
because the function has only two parameters.

I personally use partial application all the time, but never 
found myself in the need for currying so far. But maybe that's 
just because I don't have significant experience in Haskell and 
the likes.

David


More information about the Digitalmars-d mailing list