#462 Stem class makearray method to honour stem convention

None
open
nobody
None
5
2012-08-22
2012-06-16
Jon Wolfers
No

Many function packages return stems in a particular format.
There may be a name for such a stem, but I don't know it so I am calling it a classic stem.
It is how sysFiletree and many other rexxutil packages return results as well as rexxSQL, rexxCurl etc..

stem.0 has the number of items and then the tails are integers ordered 1..stem.0 such that the stem can be traversed in order like this

do i = 1 to stem.0
say stem.i
end

Could we have an option on the stem class makearray method to honour this convention.
The current stem.~makeArray does not honour the order of the tails and will include stem.0 in the returned array.

So in rexx the method would be something like:

if stem.~items \= stem.0 +1 then raise ... / badly formed classic stem /

array = .array~new(stem.0 - 1)
do i = 1 to stem.0
if symbol(stem.i) \= 'VAR' then raise ... / badly formed classic stem /
array~append(stem.i)
end

return array

The 0th element is discarded.
Obviously, there would need to be a parm passed to indicate that this is a conventional stem, how about C for 'Classic', or 'Conventional'

thanks,

Jon

Discussion


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks