| ▲ | djoldman 8 days ago |
| The programmer can define functions that operate on matrices without having to be explicit about the number of dimensions and possibly (types of data, size of data, or length). Example 1: A function that can take as input a 4x2x8 matrix or a 3x7 matrix. Example 2: A function that can take as input a 4x2x8 matrix and a 3x7 matrix and output a third matrix. |
|
| ▲ | tomsmeding 8 days ago | parent | next [-] |
| Rank polymorphism means that a function can be polymorphic in the additional dimensions of arrays. For example, if you write a function that takes a 2x3 and a 4x5 array, it can also work on 10x15x2x3 and 10x15x4x5 arrays by broadcasting. If rank polymorphism results in accepting both 4x2x8 and 3x7, then that means the function was a function on elements to begin with. Which is possible, but not the most interesting application of rank polymorphism. |
| |
| ▲ | djoldman 8 days ago | parent [-] | | > Rank polymorphism means that a function can be polymorphic in the additional dimensions of arrays. For example, if you write a function that takes a 2x3 and a 4x5 array, it can also work on 10x15x2x3 and 10x15x4x5 arrays by broadcasting. Thanks, this is what I was ineloquently attempting to describe with "A function that can take as input a 4x2x8 matrix or a 3x7 matrix." |
|
|
| ▲ | almostgotcaught 8 days ago | parent | prev [-] |
| > A function that can take as input a 4x2x8 matrix and a 3x7 matrix and output a third matrix. which shows that this feature request is complete jibberish |
| |
| ▲ | rscho 8 days ago | parent | next [-] | | Why gibberish ? It's a common feature in both array languages and Iverson ghosts, and many find it extremely useful. | |
| ▲ | tracker1 8 days ago | parent | prev [-] | | You mean like a "winner" function able to check for both Tic-Tac-Toe, a Connect Four field and a Similar 3D+ tower game? | | |
| ▲ | taeric 8 days ago | parent [-] | | I'm not sure I follow? The "winning" condition is different in all of those examples? | | |
| ▲ | tracker1 8 days ago | parent [-] | | X adjacent cell values in an N dimensional array? For tic tac toe, it's 3 in a row, for connect 4 it's 4 in a row. | | |
| ▲ | taeric 7 days ago | parent [-] | | Fair enough, I guess. The "available moves" would be dramatically different, such that I'm not clear I see much of a win on this reuse. But, yeah, fair enough. | | |
| ▲ | tracker1 7 days ago | parent [-] | | It was just the simplest case I could think of that would be reasonable. I'm not a heavy enough pure math guy to really get how an Array centric language is even all that valuable myself TBF. |
|
|
|
|
|