merging map/filter/reduce/... in D

glathoud via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 28 23:17:04 PST 2016


Hello,

I am a D beginner, please excuse me if these questions are 
irrelevant.

I had a look at this post:
http://forum.dlang.org/post/aarldotsgluwdgteentl@forum.dlang.org

Looking at the source code of compose!:
https://github.com/D-Programming-Language/phobos/blob/v2.070.0/std/functional.d#L889

I have the impression that function implementations are not 
merged:

     return fun0(fun1(a));

For example, fun1(a) outputs a temporary array, which is then 
used as input for fun0. Merging the implementations of fun0 and 
fun1 would eliminate the need for a temporary array.

Two questions:
* is my understanding correct?
* would be a "code-merging" approach (e.g. transducer) feasible 
in D?

Best regards,
Guillaume



More information about the Digitalmars-d-learn mailing list