'C' equivalent for ary.sort!

Rubyists,
I am currently struggling to write the ‘C’ equivalent of this Ruby snippet:

···

==================================================
@my_hash.each_value { |v|
v.sort! { |a,b| a[1].size <=> b[1].size }
}

I’m quite lost at rb_ary_sort_bang() and rb_ary_cmp()…
Furthermore, how do I tie in rb_hash_each_value() into rb_iterate()??


Wai-Sun “Squidster” Chia
Consulting & Integration
Linux/Unix/Web Developer Dude
"Just Another Ruby Miner"

Hi,

I am currently struggling to write the ‘C’ equivalent of this Ruby snippet:

==================================================
@my_hash.each_value { |v|
v.sort! { |a,b| a[1].size <=> b[1].size }
}

qsort()

Furthermore, how do I tie in rb_hash_each_value() into rb_iterate()??

It’s a static function, you can’t use it outside hash.c.

···

At Sun, 22 Dec 2002 22:53:35 +0900, Wai-Sun Chia wrote:


Nobu Nakada