On Tue, 14 Sep 2021, Riccardo (Jack) Lucchetti wrote:
[W]e currently don't have a way to indicate the element of a
matrix that is second-from-last, third-from-last, etc.
At present we have to use contructs like
<hansl>
b = a[3:rows(a)-1]
</hansl>
In matlab, you can use the "end" keyword, as in
<matlab>
b = a(3:end-1)
</matlab>
I was wondering if we could have the same syntax (and ideally extend it to
other multidimensional objects, such as arrays).
In current git there's a first pass at implementing this, for
matrices. It's a bit of a hack, but a more rigorous version would be
quite complicated. (That's because, unlike other "dummy" constructs
such as "diag", presumably "end" has to work with arithmetic, as in
your "end-1" above; it can't be just a stand-alone dummy taking the
place of a numerical value, which would be much simpler.)
Allin