Ajay Askoolum wrote:The objective was to remove the diagonal elements - so the second dimension of a 2D array should reduce by 1. This can happen only if the 2D array is square.
No, it also can work the same way when the array is "short" (as in your example above)
Ajay Askoolum wrote:If the array is NOT square, neither dimension will decrease - that means that for , say, your 10x6, there will be a padding with 0 in the first six rows of the first or last column depending on whether you are removing the left- or right- diagonal. Almost certainly not what might be required.
Well, no - if it's "short" then the last dimension can decrease (as in your example above). It's only for "long" arrays (or if you decide to compress in the other dimension) that you have a problem. And I agree that it makes no sense to fill some areas with zeros in any case.
Ajay Askoolum wrote:However, there is no reason why interpreter level support for removing diagonal elements from square matrices cannot be provided: as with many other operators, this need only work when the arguments are conformable.
I disagree. The interpreter should only do things that are well-consistent and well-defined and meaningful for a large range of inputs, or it's not a good candidate for a language improvement. In this case, a function that only works on square, two-dimensional matrices is not something that I think should be built into the language proper. That would seem to be a better candidate for a user-defined utility function at best, and I probably wouldn't even go that far.
Besides, how often do you need to use this feature - is it something that you use as often as "+"? Is it something that has a common mathematical purpose? Is it something that you can't easily do by writing your own function instead? I personally don't really see this as useful at all, much less as a function required by many applications in general, but perhaps you can correct my opinion on this.