### Re: Finding Max Value of Column in Multi-Dimesional Array

On Friday, 5 July 2019 at 19:56:54 UTC, ag0aep6g wrote: It works when you pass an actual callable instead, e.g. a lambda: p.map!(a => a[column]).maxElement.writeln; On Friday, 5 July 2019 at 20:22:14 UTC, dwdv wrote: Furthermore, Samir, the parameter `a` can be renamed to whatever you

### Re: Finding Max Value of Column in Multi-Dimesional Array

On 7/5/19 9:56 PM, ag0aep6g via Digitalmars-d-learn wrote: On 05.07.19 20:49, Samir wrote: As a follow-on to my earlier question, is there a way to pass a variable to the `map` function that specifies the column, rather than hard-coding it?  I'm thinking of something like:

### Re: Finding Max Value of Column in Multi-Dimesional Array

On 7/5/19 9:56 PM, ag0aep6g via Digitalmars-d-learn wrote: On 05.07.19 20:49, Samir wrote: As a follow-on to my earlier question, is there a way to pass a variable to the `map` function that specifies the column, rather than hard-coding it?  I'm thinking of something like:

### Re: Finding Max Value of Column in Multi-Dimesional Array

On 05.07.19 20:49, Samir wrote: As a follow-on to my earlier question, is there a way to pass a variable to the `map` function that specifies the column, rather than hard-coding it?  I'm thinking of something like: p.map!("a[column]").maxElement.writeln; You can't do that with the string

### Re: Finding Max Value of Column in Multi-Dimesional Array

On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

### Re: Finding Max Value of Column in Multi-Dimesional Array

On Friday, 5 July 2019 at 01:41:38 UTC, 9il wrote: You may want to take a look into mir-algorithm [1] library. It contains ndsilce package [2] to work with multidimensional data. Thanks for referring me to this library, Ilya. I will have to check this out. While it seems a bit more

### Re: Finding Max Value of Column in Multi-Dimesional Array

On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

### Re: Finding Max Value of Column in Multi-Dimesional Array

On Friday, 5 July 2019 at 00:54:15 UTC, Samir wrote: Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0,

### Finding Max Value of Column in Multi-Dimesional Array

Is there a cleaner way of finding the maximum value of say the third column in a multi-dimensional array than this? int[][] p = [[1,2,3,4], [9,0,5,4], [0,6,2,1]]; writeln([p[0][2], p[1][2], p[2][2]].max); I've tried the following writeln([0, 1, 2].map!(p[a][2]).max); but get an "Error: