Any guide to stream (string) processing in D? | Re: Any python-like generator patterns in D?

Samuel Lampa samuel.lampa at gmail.com
Thu Feb 21 06:45:05 PST 2013


I'm coming back to this again [1].

What I still remain looking for is a concise guide on how to do stream 
(string) processing in D, in a (hopefully) as simple and elegant way as 
possible? [2] Any tips?

(The InformIT article seemed rather technical, and more focused on 
proposing new APIs than explaining how to actually do this in D, as 
efficiently as possible)

Best Regards
// Samuel

[1] Thinking to re-implement in D, some bioinformatics python scripts 
I've created for Rosalind course platform.
[2] I'm using generator functions in python, so I wanted to get the same 
nice low memory usage, by using stream processing


On 09/08/2011 10:33 PM, Samuel Lampa wrote:
> Many thanks!
>
> I'll check these links.
>
> // Samuel
>
> On 09/08/2011 07:47 PM, Ali Çehreli wrote:
>> On Thu, 08 Sep 2011 13:35:02 +0200, Samuel Lampa wrote:
>>
>>> Hi,
>>>
>>> I found these slides very interesting, on how python generator patterns
>>> can be used to create re-usable code-parts that can be "piped" togegher
>>> ad infinitum, to create e.g. parsing pipelines requiring minimal memory
>>> (things a sysadmin working with huge files might need quite often):
>>>
>>> http://www.dabeaz.com/generators/index.html PDF:
>>> http://www.dabeaz.com/generators/Generators.pdf
>>>
>>> It would be nice to do this kind of stuff in D though, to hopefully 
>>> gain
>>> some performance, so I wonder, is there similar stuff in D, and 
>>> where to
>>> find info about it?
>>>
>>> Cheers,
>>> Samuel
>> D uses the range concept. Phobos ranges are based on the ideas presented
>> in this article:
>>
>> http://www.informit.com/articles/printerfriendly.aspx?p=1407357
>>
>> But some of the design and even the names of range types have changed
>> since that article has been written.
>>
>> These and other Phobos modules make use of ranges:
>>
>>    http://www.d-programming-language.org/phobos/std_range.html
>>
>> http://www.d-programming-language.org/phobos/std_algorithm.html
>>
>>    http://www.d-programming-language.org/phobos/std_array.html
>>
>> Ali
>>
>> P.S. I am in the process of translating my Turkish D book to English. 
>> For
>> completeness, here are the two chapters about ranges:
>>
>>    http://ddili.org/ders/d/araliklar.html
>>
>>    http://ddili.org/ders/d/araliklar_baska.html
>


-- 
Developer at SNIC-UPPMAX www.uppmax.uu.se
Developer at Dept of Pharm Biosciences www.farmbio.uu.se



More information about the Digitalmars-d-learn mailing list