A currying function

Philippe Sigaud philippe.sigaud at gmail.com
Thu Jun 21 12:04:24 PDT 2012


On Tue, Jun 19, 2012 at 2:52 PM, Artur Skawina <art.08.09 at gmail.com> wrote:

> I'm not really sure when you'd want to use this in D.

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);

And so on. When mapping and filtering ranges, I need currying from
time to time.


> But, just to be able to say "Real Programmers don't use mixins": :)

I find Bearophile version quite nice. I did something equivalent a few
years ago, with string mixins also. Of course, the a => b syntax did
not exist then.
I


More information about the Digitalmars-d mailing list