On 09.03.2025 11:58, Jeremy Nicoll wrote:
On Sun, 9 Mar 2025, at 10:39, Rony G. Flatscher wrote:
1) ad stem arrays
==============
Stem arrays have been conceived and used since the inception of Rexx.
The pattern is simple: the tail is an integer number from 1 on, the
tail with the value 0 keeps the
current number of total stem array elements. E.g.:
a.1="one"
a.2="two"
a.0=2
say "there are" a.0 "items"
Turning such a stem array into an ooRexx array should yield an array
that omits the element with the
tail 0 and uses the tail's number as index in the ooRexx array. E.g.
turning the above stem array
into an ooRexx array:
a[1]="one"
a[2]="two"
say "there are" a~itmes "items"
1a) In order to create an ooRexx array from a stem array the following
method should be added to the
stem class:
makeArrayFromStemArray
Should the method (optionally?) check that that the stem array didn't have
any elements with tails not meeting the only-incrementing-integers rule?
For example, if one has
a.1="one"
a.2="two"
a.3="what about this?"
a.0=2
a.0.1 = "something else"
a.0.2 = "and this"
would it work (create a 2-element array) but ignore a.3 and the extra a.0.n
elements?
Good question!
The intent would be to only process "plain" stem arrays, i.e. the tail can only be a single zero or
a single whole positive number. If there are other tail values then a condition should be raised.
Should there also be an option to drop either the whole original stem, or
perhaps just the elements that ended up in the array?
As the conversion is from one value to another, there should be no side effects imposed on the
source (the stem array).
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel