Re: Selected elements from splitter output

2021-05-04 Thread Chris Piker via Digitalmars-d-learn
On Tuesday, 4 May 2021 at 22:02:11 UTC, Ali Çehreli wrote: On 5/4/21 1:40 PM, Chris Piker wrote: > I only care about columns 0, 2, 3, 4, 8, 9, 10. That's std.range.stride. > char[][] wanted = string_range.get( [1, 5, 7] ); // pseudo-code element That's std.range.indexed. Hey Thanks! And e

Re: Selected elements from splitter output

2021-05-04 Thread Ali Çehreli via Digitalmars-d-learn
On 5/4/21 3:02 PM, Ali Çehreli wrote: >// Note: The above works only because 'stride' applies >// "design by introspection" (DbI) and is able to work as a >// RandomAccessRanges. Ok, I was too enthusiastic there. The RandomAccessRange'ness of the input range changes how efficient st

Re: Selected elements from splitter output

2021-05-04 Thread Ali Çehreli via Digitalmars-d-learn
On 5/4/21 1:40 PM, Chris Piker wrote: > I only care about columns 0, 2, 3, 4, 8, 9, 10. That's std.range.stride. > char[][] wanted = string_range.get( [1, 5, 7] ); // pseudo-code element That's std.range.indexed. import std.range; import std.stdio; void main() { auto r = 10.iota.stride(2)

Selected elements from splitter output

2021-05-04 Thread Chris Piker via Digitalmars-d-learn
Hi D I have a white-space delimited file with quite a few columns, but I only care about columns 0, 2, 3, 4, 8, 9, 10. Since I don't need most of the 60+ columns it seemed like: std.algorithm.iteration.splitter() would be a better function to use then std.array.split(). My problem is t