On 2/19/2004 2:25 PM Adam Thornton wrote:
<snip>
There's no way in Rexx to get a list of all the key
names in the key/value pairs that make up a stem.  I find that a huge
problem in terms of conceptualizing problems the intuitive way for me.

I've resorted to using a second compound variable to keep track of the of the first compound variable [warning: following code is off the top of my head]...

 MainStem. = '00'x  /* default value for unused keys */
 TailStem. = ''
 TailStem.0 = 0

 x = 'Something to put in stem variable'
 y = 'key of Something'

/* to add/update a key-value pair */
 if MainStem.y = '00'x then do  /* add new key? */
    i = TailStem.0 + 1
    TailStem.i = y
    TailStem.0 = i
    end
 MainStem.y = x

/* extract key-value pairs */
 for i = 1 to TailStem.0
   y = TailStem.i
   say y '=' MainStem.y
 next i

I agree that access to tail values would be a dandy addition to the
language, either as a function or using some other syntax. I know some
folks have written assembler functions to extract compound symbol's tails.

--
jcf ~ zjcf at Dawn and John dot net
Always ready to talk Rexx.

Reply via email to