Collapsing n-dimensional array to linear (1 dimensional)

ixid via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 25 04:54:29 PST 2016


On Monday, 25 January 2016 at 08:31:14 UTC, abad wrote:
> On Monday, 25 January 2016 at 02:27:57 UTC, Solomon E wrote:
>> On Saturday, 23 January 2016 at 07:57:55 UTC, Ali Çehreli
> Ruby's Array class includes this sort method for flattening and 
> for me it was surprisingly useful, for instance when it was 
> necessary to write the array to file.

D could certainly add a few more helper functions to work on 
multidimensional data or perhaps an article, I admit I was 
unaware joiner could be chained without mapping like that. One 
that regularly irritates me is arrays of results that you want to 
make eager such that you can map a lazy function to a 2D array 
and then store the result in a 2D array again. This seems messy 
and I'd like a function that will take absolutely anything and 
force eager assessment.

auto a = res.map!array.array; // De-lazying 2D result

Would like:

auto a = res.eager;


More information about the Digitalmars-d-learn mailing list