Reading files using delimiters/terminators

oddp oddp at posteo.de
Mon Dec 28 00:35:19 UTC 2020


On 28.12.20 00:12, Rekel via Digitalmars-d-learn wrote:
> is there a reason to use either 'splitter' or 'split'?

split gives you a newly allocated array with the results, splitter is lazy equivalent and doesn't 
allocate. Feel free using either, doesn't matter much with these small puzzle inputs.

> Sidetangent, don't mean to bash the learning tour, as it's been really useful for getting started, 
> but I'm surprised stuff like tuples and files arent mentioned there.
> Especially since the documentation tends to trip me up, with stuff like 'isSomeString' mentioning 
> 'built in string types', while I haven't been able to find that concept elsewhere, let alone 
> functionality one can expect in this case (like .length and the like), and stuff like 'countUntil' 
> not being called 'indexOf', although it also exists and does basically the same thing. Also 
> assumeUnique seems to be a thing?

Might be worth discussing that in a new topic. The stdlib is vast and has tons of useful utilities, 
not all of which can be explained in detail in a series of overview posts. Ali's "Programming in D" 
[1], which has a free online version, functions as an excellent in-depth introduction to the 
language, going over all the important topics.

Regarding function names and docs: Yes, some might seem slightly off coming from other languages 
(e.g. find vs. dropWhile, until vs. takeWhile, cumulativeFold vs scan/accumulate, etc.), but it's 
all in there somewhere, implemented with the most care to not waste precious cycles. Might makes it 
harder to grok going over the implementation or docs for very the first time, but it gets easier 
after a while. Furthermore, alternative names are often times mentioned in the docs so a quick 
google search should bring you to the right place.

[1] http://ddili.org/ders/d.en/index.html


More information about the Digitalmars-d-learn mailing list