D as a prototyping language (for C/C++ projects)
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Feb 28 07:18:06 PST 2013
On 2/28/13 3:03 AM, Jacob Carlborg wrote:
> On 2013-02-27 22:59, Andrei Alexandrescu wrote:
>
>> I like Tap (including the name). It is similar to Unix's "tee" utility.
>
> Cool, is this something that could be included in Phobos? If yes, where?
I think it belongs to std.range.
1. tap!fun(r) returns a new range (of a new type R1 distinct from
typeof(r)). Upon the first call to .front without an intervening
popFront, fun(r.front) is called.
2. tap!(fun1, fun2)(r) also returns a new range, calls fun1 as described
above, and fun2 whenever popFront() gets called without the front()
being looked at. So fun1 tracks the looked-at data and fun2 tracks the
ignored data.
Andrei
More information about the Digitalmars-d
mailing list