Is this code "D-ish" enough?

Justin Whear justin at economicmodeling.com
Wed Aug 7 11:36:24 PDT 2013


On Wed, 07 Aug 2013 20:25:33 +0200, lafoldes wrote:

> 
> There are things, I don'like here:
> 
> - the dummy repeat at the beginning of the component chain. The only
> purpose of it is to produce the needed number of items. Moreover repeat
> doesn't produce sortable range, so the array is needed as well.
> - I don't know how to do this when the number of items is nor known. How
> to repeat until EOF?
> - The variables id, and lineNo outside the chain.
> - rawRead() needs an array, even if there is only one item to read.
> - How to avoid the flush() at the end?
> 
> What do you think?

Is 0 present as an id in the file?  If not, you could treat the file as a 
range of bytes, use lazy split('\0') on it, then use the peek function 
from std.bitmanip to split each "line" into an integer-string tuple.



More information about the Digitalmars-d-learn mailing list