Is this code "D-ish" enough?

Tobias Pankrath tobias at pankrath.net
Thu Aug 8 09:41:26 PDT 2013


On Wednesday, 7 August 2013 at 18:25:37 UTC, lafoldes wrote:
>
> What do you think?

You could use sequence!("n") to get rid of repeat(0, count) and 
lineNO. This will still be strangely backwards. To get a general 
solution you'll need to base the iteration on the number of 
entries in your file and not on the number of lines you think 
that are in that file.

While the solution proposed by Whear does not work because of ref 
issues, you could do something with recurrence and a state that 
is a tuple (state', elem), but I don't think thats the way to go 
here.

Just write your own range that reads the file and yields (int, 
string).


More information about the Digitalmars-d-learn mailing list