sort, .array and folding on immutable data (finding most common character in column of matrix)

Nicholas Wilson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 19 04:45:48 PST 2016


On Monday, 19 December 2016 at 11:42:55 UTC, Ali wrote:
> On Monday, 19 December 2016 at 10:03:34 UTC, Nicholas Wilson 
> wrote:
>>> [...]
>
> The seedless version without the typeof(a)(b[0], b[1]) hack 
> (with default inited T) seems to crap out with:
>
> [...]

Ah, oh well. It was nice in theory.

>
> [...]

auto word = data.map!(reduce!max).array.map!"a[1]".array;

you want

auto word = data.map!"a[1]".map!(reduce!max).array;

which will try to take the max of a single variable, not a tuple, 
which should succeed.


More information about the Digitalmars-d-learn mailing list