"fold": a replacement for "reduce"

Simen Kjærås simen.kjaras at gmail.com
Thu Mar 27 10:16:28 PDT 2014


On 2014-03-27 16:33, monarch_dodra wrote:
> On Thursday, 27 March 2014 at 15:54:46 UTC, Simen Kjærås wrote:
>> On 2014-03-27 15:33, Meta wrote:
>> Is it even necessary to specifically have a binary version of that?
>> This seems to be a working generalization of binaryReverseArgs:
>
> In binaryReverseArgs's defense, it was written before "Reverse!". But
> yes, it's just a question of time before binaryReverseArgs is replaced.
>
> It's just a matter of having someone tackle the issue and submit a
> proposal *hint* ;)

Done:
https://github.com/D-Programming-Language/phobos/pull/2054


>> On the same note, binaryFun and unaryFun seem to me unnecessary
>> specializations of a more general 'fun' template. Philippe Sigaud has
>> an implementation in his dranges called naryFun
>> (https://github.com/PhilippeSigaud/dranges). That code has apparently
>> not been touched for at least two years, so YMMV.
>
> Also yes, but the general feeling around here, is that "string
> functions" are a thing of the past, and should be replaced by "real"
> lambda functions.
>
> As such, even if "naryFun" works, it promotes the use of something that
> is unpopular, and that some would like to see disappear.

True.

--
   Simen


More information about the Digitalmars-d mailing list