Bil Kleb wrote:
> Hal Fulton wrote:
> >
> > My use case (I started that thread) may not be compelling. Other people,
> > including Bil Kleb, have said it would be useful to them also.
>
> So far, I've managed to duplicate the functionality of two
> Java codes having 834 and 1084 lines of codes with 24 and 55
> lines of Ruby, respectively.  The second one is so long[1]
> due to the lack of ordered Hashes

Did you try association lists?

class Array
  def to_assoc
    f=nil  ;  partition{f=!f}.transpose
  end
  def set k, v
    (pair = assoc(k))  ?  self[ index(pair) ] = [k,v]  :  push( [k,v] )
  end
  def rm k
    (pair = assoc( k ))  &&  slice!( index( pair ) )
  end
end

a = [:foo,22,  :bar,33,  :baz,44].to_assoc
a.set( :bar, 99 )
a.set :yes, -1
a.rm :baz
p a