Am 14.09.2021 08:41 schrieb Riccardo (Jack) Lucchetti:
The recent fix to the biprobit command led me to think about the
fact
that we 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). After all,
"end" is already a reserved word, so there's no risk of "end"
being a
pre-existing identifier. This feature would probably complicate a bit
the handling of the matrix slicing syntax, but I guess it's doable.
Question #1: is this desirable? (My answer: yes) Question #2: is this
doable? (I guess it is) Question #3: is this worth implementing for
2021d, which is going to be out soon? (maybe not).
Hi,
I also think that this is desirable: I so often thought that this may be
useful in the contexts of a matrix and of an array (even series?).
One question: How would such an "end" operator work "under the hood"?
a) Is it triggering the computation of rows(X) AND cols(X) each time
"end" is called, or
b) is it a property of matrix X, meaning that once X is initialized, the
number of rows and columns is automatically computed and this
information stored as a property of the object X?
Best,
Artur