Re: Combining "chunkBy" and "until" algorithms

2016-11-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-05 14:57, Timon Gehr wrote: "chunkBy" a predicate that checks whether a line is standard. Use 'zip' to focus two adjacent chunks at the same time. Use 'filter' to only consider adjacent chunks where the first chunk consists of standard lines. Then extract the last line of the first

Re: Combining "chunkBy" and "until" algorithms

2016-11-05 Thread Timon Gehr via Digitalmars-d-learn
On 04.11.2016 09:04, Jacob Carlborg wrote: I have a file with a bunch of lines I want to process. I want to process these lines line by line. Most of these lines have the same pattern. Some of the lines have a different pattern. I want to bundle those lines, which have a non-standard pattern,

Re: Combining "chunkBy" and "until" algorithms

2016-11-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-11-04 16:23, Edwin van Leeuwen wrote: Could you filter [1] for the non standard pattern? Filter is lazy, so will only start looking for the next when the current one has been "handled". Hmm, no I don't think so. Do you have an example of how this would work? -- /Jacob Carlborg

Re: Combining "chunkBy" and "until" algorithms

2016-11-04 Thread Edwin van Leeuwen via Digitalmars-d-learn
On Friday, 4 November 2016 at 08:04:12 UTC, Jacob Carlborg wrote: Currently I'm using a standard for loop iterating over the lines. I'm always looking at the current line and the next line. When the current line is the standard pattern and the next line is is not, I do a separate loop until I

Combining "chunkBy" and "until" algorithms

2016-11-04 Thread Jacob Carlborg via Digitalmars-d-learn
I have a file with a bunch of lines I want to process. I want to process these lines line by line. Most of these lines have the same pattern. Some of the lines have a different pattern. I want to bundle those lines, which have a non-standard pattern, together with the last line that had the