From: Ralph Shnelvar on 28 Feb 2010 09:10 These are general questions about Ruby and not specific to uniq. (1) How can I tell if a method like uniq is "native" to Ruby. That is, it's not been added as a C extension and/or is not a Ruby method. (2) A C++ program is producing YAML from a ragged array. As I go through each row of the ragged array in the C++ program, I could detect if all items are unique ... or I can do this in Ruby. I'd prefer to do this in Ruby if the cost is not "too high". (3) Is there an easy way to find out how uniq is implemented in 1.8 and 1.9?
From: Phrogz on 28 Feb 2010 09:27 On Feb 28, 7:10 am, Ralph Shnelvar <ral...(a)dos32.com> wrote: > (1) How can I tell if a method like uniq is "native" to Ruby. That is, it's not been added as a C extension and/or is not a Ruby method. Look in the source code. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ In this case, look for "rb_ary_uniq". http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=markup (You can search for a phrase from the ri documentation to find the method.) > (2) A C++ program is producing YAML from a ragged array. As I go through each row of the ragged array in the C++ program, I could detect if all items are unique ... or I can do this in Ruby. I'd prefer to do this in Ruby if the cost is not "too high". If this is a question, I don't understand it. > (3) Is there an easy way to find out how uniq is implemented in 1.8 and 1..9? Look in the source code. You can find the different branches of Ruby here: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/
|
Pages: 1 Prev: Shoes? Next: [ANN] Final Call: Red Dirt RubyConf Proposals |