Range tee()?

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Mon Oct 16 07:28:03 UTC 2017


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.


More information about the Digitalmars-d-learn mailing list