reduce -> fold?

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 30 10:08:00 PST 2016


On Saturday, 30 January 2016 at 17:40:38 UTC, Andrei Alexandrescu 
wrote:
> I forgot the distinction between currying and partial 
> application. Can we also define currying in current D? -- Andrei

Currying is turning (A, B, C) -> D into A -> (B -> (C -> D)), 
i.e. a function with multiple arguments into a sequence of 
functions that each take a single argument to apply each.

I think I've implemented something like that for fun once, but 
never really found much use for it. In the few places where I 
could have used it (mostly binary functions), just using a lambda 
and partial application seemed to be much more idiomatic. I guess 
D lacks any idioms that would make its use come naturally.

  - David


More information about the Digitalmars-d mailing list