Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 16, 2017 Range tee()? | ||||
---|---|---|---|---|
| ||||
Does Phobos have a way to "tee" a range? For example, suppose you had something like this: ------------------------------------------------- // Do something with each file in a dir dirEntries(selectedDir, SpanMode.shallow) .filter!someFilterCriteria .doSomethingWithFile; ------------------------------------------------- It would be really nice to be able to "wiretap" that, to trace/debug/etc by nothing more than ADDING a single statement at any desired wiretap point: ------------------------------------------------- // Do something with each file in a dir dirEntries(selectedDir, SpanMode.shallow) //.tee(a => writeln("FOUND: ", a)) // DEBUG: TRACE ALL FILES FOUND! .filter!someFilterCriteria //.tee(a => writeln("SELECTED: ", a)) // DEBUG: TRACE RESULT OF FILTER! .doSomethingWithFile; ------------------------------------------------- Does something like this already exist Phobos? I tried looking for a "tee" in st.algorithm but came up nothing. If not, it seems like a pretty glaring omission. |
October 16, 2017 Re: Range tee()? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: > Does Phobos have a way to "tee" a range? > > For example, suppose you had something like this: > > [...] https://dlang.org/phobos/std_range.html#tee ? |
October 16, 2017 Re: Range tee()? | ||||
---|---|---|---|---|
| ||||
Posted in reply to lobo | On 10/16/2017 03:30 AM, lobo wrote:
> On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote:
>> Does Phobos have a way to "tee" a range?
>>
>> For example, suppose you had something like this:
>>
>> [...]
>
> https://dlang.org/phobos/std_range.html#tee ?
Ahh, thanks, I was only looking in std.algorithm. Didn't expect it to be in std.range.
|
October 16, 2017 Re: Range tee()? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Monday, 16 October 2017 at 07:28:03 UTC, Nick Sabalausky (Abscissa) wrote: > Does Phobos have a way to "tee" a range? use my dpldocs search engine http://dpldocs.info/tee std.range pops right up! |
Copyright © 1999-2021 by the D Language Foundation