D as a prototyping language (for C/C++ projects)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Feb 27 13:59:39 PST 2013


On 2/27/13 3:53 PM, Ary Borenszweig wrote:
> Tap is nice when you want to print-debug something and you have a chain
> of calls:
>
> auto foo = x.map!(...).reduce!(...).nWayUnion!(...);
>
> Now something is not working correctly and you want to see what's after
> the "reduce!" step:
>
> auto foo = x.map!(...).reduce!(...).tap!(r) { writefln(r);
> }).nWayUnion!(...);
>
> Otherwise you'd have to break it in many lines and then put them back
> together.

I like Tap (including the name). It is similar to Unix's "tee" utility.

Andrei


More information about the Digitalmars-d mailing list