R
Ralph Shnelvar
If I want to find the source to the Class Array ... specifically
Array.assoc ... where would I look?
Array.assoc ... where would I look?
If I want to find the source to the Class Array ... specifically
Array.assoc ... where would I look?
Slim2:~ phrogz$ cd /usr/local/src/ruby-1.9.1-p243/
Slim2:ruby-1.9.1-p243 phrogz$ grep -E "define_method.+assoc" *.c
array.c: rb_define_method(rb_cArray, "assoc", rb_ary_assoc, 1);
array.c: rb_define_method(rb_cArray, "rassoc", rb_ary_rassoc, 1);
hash.c: rb_define_method(rb_cHash, "assoc", rb_hash_assoc, 1);
hash.c: rb_define_method(rb_cHash, "rassoc", rb_hash_rassoc, 1);
So, look for the function named rb_cArray in the array.c file in the
ruby source code.
(C) Assume that ary is sorted by RARRAY_PTR(v)[0] so that one could do
a binary search instead of a linear search. What user group would I
talk to to talk about adding arb_ary_sortedassoc?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.