Re: optional process

2019-12-05 Thread Taylor Hillegeist via Digitalmars-d-learn
On Friday, 6 December 2019 at 05:09:58 UTC, Paul Backus wrote: On Thursday, 5 December 2019 at 17:27:45 UTC, Taylor Hillegeist wrote: I agree with this. I wasn't clear enough in my question though. I was trying to distinguish between std.functional.compose and std.functional.pipe they look ve

Re: optional process

2019-12-05 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 5 December 2019 at 17:27:45 UTC, Taylor Hillegeist wrote: I agree with this. I wasn't clear enough in my question though. I was trying to distinguish between std.functional.compose and std.functional.pipe they look very the same. Pipe says it reverses functions order. Which makes

Re: optional process

2019-12-05 Thread Taylor Hillegeist via Digitalmars-d-learn
On Thursday, 5 December 2019 at 15:43:30 UTC, Paul Backus wrote: On Thursday, 5 December 2019 at 15:30:52 UTC, Taylor Hillegeist wrote: On Friday, 29 November 2019 at 15:24:31 UTC, Paul Backus wrote: .pipe!((output) { if (sortOutput) return output.sort!("a < b"); else

Re: optional process

2019-12-05 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 5 December 2019 at 15:30:52 UTC, Taylor Hillegeist wrote: On Friday, 29 November 2019 at 15:24:31 UTC, Paul Backus wrote: .pipe!((output) { if (sortOutput) return output.sort!("a < b"); else return output; }) .writeln(); // maybe you meant eac

Re: optional process

2019-12-05 Thread Taylor Hillegeist via Digitalmars-d-learn
On Friday, 29 November 2019 at 15:24:31 UTC, Paul Backus wrote: .pipe!((output) { if (sortOutput) return output.sort!("a < b"); else return output; }) .writeln(); // maybe you meant each!writeln ? Why pipe as apposed to compose? Pipes functions in sequen

Re: optional process

2019-11-29 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Friday, 29 November 2019 at 15:24:31 UTC, Paul Backus wrote: On Friday, 29 November 2019 at 15:17:35 UTC, Taylor R Hillegeist wrote: I know phobos has choose which is close. But what I want is something like: bool sortOutput; if(sortOutput){ read(Textfile) .splitter("\n") .filter(a=>a

Re: optional process

2019-11-29 Thread Paul Backus via Digitalmars-d-learn
On Friday, 29 November 2019 at 15:17:35 UTC, Taylor R Hillegeist wrote: I know phobos has choose which is close. But what I want is something like: bool sortOutput; if(sortOutput){ read(Textfile) .splitter("\n") .filter(a=>a.contains("data)) .doif(sortOutput,sort!("a < b")) .writeln

optional process

2019-11-29 Thread Taylor R Hillegeist via Digitalmars-d-learn
When using the standard library. and making command-line applications I find myself wanting optional processes in line. for me, this typically makes the following structure. bool sortOutput; if(sortOutput){ read(Textfile) .splitter("\n") .filter(a=>a.contains("data)) .sort!("a < b").w