Trans <transfire / gmail.com> wrote:

> We can:
> 
>   a = [2,1]
>   [3,*a]  #=> [3,2,1]
> 
> How about:
> 
>   h = {:b=>2, :a=>1}
>   {:c => 3, **h}  #=> {:c=>3, :b=>2, :a=>1}

How about:

class Hash; alias_method :<<, :merge!; end

So, for example:

h = {:b=>2, :a=>1}
{:c => 3} << h 
#=> {:c=>3, :b=>2, :a=>1}

But perhaps I'm missing some desideratum other than brevity. m.
-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com