Flatten range of ranges

Philippe Sigaud philippe.sigaud at gmail.com
Thu May 6 10:01:04 PDT 2010


On Thu, May 6, 2010 at 18:24, Ali Çehreli <acehreli at yahoo.com> wrote:

> Ali Çehreli wrote:
>
>> new to d wrote:
>>
>>> Is there any function in phobos that does something like that:
>>>
>>> auto a = [[1,2],[3,4]];
>>> assert(equals(flatten(a), [1,2,3,4]));
>>>
>>> I am just learning D and ca't find anything like that in the docs.
>>>
>>
I've this in a dsource project:

http://svn.dsource.org/projects/dranges/trunk/docs/range2.html
(look for flatten or concat). It's a lazy range. Flatten depends on a
template for wrapping code, present in the traits2 module.

http://www.dsource.org/projects/dranges/browser/trunk/range2.d
http://www.dsource.org/projects/dranges/browser/trunk/traits2.d

Hmm, this is waiting for quite an update. I've lots of thing for
producing/mapping/filtering... ranges of ranges while conserving their
topology/rank.
If you find anything useful for you in this project, tell me!


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20100506/b92ffda1/attachment.html>


More information about the Digitalmars-d-learn mailing list