<ppdoc>
<copyright>
Copyright (c) 2001 by Addison Wesley Longman, Inc. This material may
be distributed only subject to the terms and conditions set forth in
the Open Publication License, v1.0 or later (the latest version is
presently available at http://www.opencontent.org/openpub/).
<p/>
Distribution of substantively modified versions of this document is
prohibited without the explicit permission of the copyright holder.
<p/>
Distribution of the work or derivative of the work in any standard
(paper) book form is prohibited unless prior permission is obtained
from the copyright holder.
</copyright>
<class name="Array" super="Object" type="class" ref="xref-000001">
<p/>
  Arrays are ordered, integer-indexed collections of any object.
  Array indexing starts at 0, as in C or Java.  A negative index is
  assumed relative to the end of the array---that is, an index of -1
  indicates the last element of the array, -2 is the next to last
  element in the array, and so on.
  <mixins>
    <mixin name="Enumerable">
   collect, detect, each_with_index, entries, find, find_all, grep,
   include?, map, max, member?, min, reject, select, sort, to_a</mixin>
  </mixins>
<p/>
  <methods type="class">
        <method name="[ ]" ref="_ob_cb">
      <callseq>
        Array[ <optz>anObject</optz> ]
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array populated with the given objects. Equivalent to
      the operator form <tt>Array.[](</tt><em>...</em><tt>)</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[        Array.[]( 1, 'a', /^A/ )
        Array[ 1, 'a', /^A/ ]
        [ 1, 'a', /^A/ ]
]]></fullcode><rubycode>
<tr>
  <td><tt>Array.[](<nbsp/>1,<nbsp/>'a',<nbsp/>/^A/<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>"a",<nbsp/>/^A/]</tt></td>
</tr>
<tr>
  <td><tt>Array[<nbsp/>1,<nbsp/>'a',<nbsp/>/^A/<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>"a",<nbsp/>/^A/]</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>'a',<nbsp/>/^A/<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>"a",<nbsp/>/^A/]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="new" ref="new">
      <callseq>
        Array.new( <obj>anInteger=0</obj>, <obj>anObject=nil</obj> )
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array, optionally with a size and initial value
      (that is, <obj>anInteger</obj> references to the same
      <obj>anObject</obj>).
<p/>
<codefragment>
<fullcode><![CDATA[         Array.new
         Array.new(2)
         Array.new(5, "A")
         Array.new(2, Hash.new)
]]></fullcode><rubycode>
<tr>
  <td><tt>Array.new</tt></td>
  <td>&#187;</td>
  <td><tt>[]</tt></td>
</tr>
<tr>
  <td><tt>Array.new(2)</tt></td>
  <td>&#187;</td>
  <td><tt>[nil,<nbsp/>nil]</tt></td>
</tr>
<tr>
  <td><tt>Array.new(5,<nbsp/>"A")</tt></td>
  <td>&#187;</td>
  <td><tt>["A",<nbsp/>"A",<nbsp/>"A",<nbsp/>"A",<nbsp/>"A"]</tt></td>
</tr>
<tr>
  <td><tt>Array.new(2,<nbsp/>Hash.new)</tt></td>
  <td>&#187;</td>
  <td><tt>[{},<nbsp/>{}]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
   </methods>
<p/>
  <methods type="instance">
        <method name="&amp;" ref="_et">
      <callseq>
        <obj>arr</obj> &amp; <obj>anOtherArray</obj>
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Set Intersection---Returns a new array
      containing elements common to the two arrays, with no duplicates.
<p/>
<codefragment>
<fullcode><![CDATA[         [ 1, 1, 3, 5 ] & [ 1, 2, 3 ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>1,<nbsp/>3,<nbsp/>5<nbsp/>]<nbsp/>&amp;<nbsp/>[<nbsp/>1,<nbsp/>2,<nbsp/>3<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>3]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="*" ref="_st">
      <callseq>
                   <obj>arr</obj> * <obj>anInteger</obj> <returns><obj>anArray</obj></returns><br/><obj>arr</obj> * <obj>aString</obj>   <returns><obj>anOtherString</obj></returns>
      </callseq>
      <desc>
<p/>
       Repetition---With a <classname>String</classname> argument, equivalent to
       <tt><obj>arr</obj>.join(aString)</tt>. Otherwise, returns a new array
       built by concatenating the <obj>anInteger</obj> copies of <obj>arr</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[         [ 1, 2, 3 ] * 3
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>2,<nbsp/>3<nbsp/>]<nbsp/>*<nbsp/>3</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3,<nbsp/>1,<nbsp/>2,<nbsp/>3,<nbsp/>1,<nbsp/>2,<nbsp/>3]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="+" ref="_pl">
      <callseq>
        <obj>arr</obj> + <obj>anOtherArray</obj>
         <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
       Concatenation---Returns a new array built by concatenating the
       two arrays together to produce a third array.
<p/>
<codefragment>
<fullcode><![CDATA[         [ 1, 2, 3 ] + [ 4, 5 ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>2,<nbsp/>3<nbsp/>]<nbsp/>+<nbsp/>[<nbsp/>4,<nbsp/>5<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="--" ref="_mi_mi">
      <callseq>
        <obj>arr</obj> - <obj>anOtherArray</obj>
         <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
       Set Difference---Returns a new array that is a copy of
       the original array, removing any items that also appear in
       <obj>anOtherArray</obj> and duplicated items.
<p/>
<codefragment>
<fullcode><![CDATA[         [ 1, 1, 2, 2, 3, 3, 3, 4, 5 ] - [ 1, 2, 4 ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>1,<nbsp/>2,<nbsp/>2,<nbsp/>3,<nbsp/>3,<nbsp/>3,<nbsp/>4,<nbsp/>5<nbsp/>]<nbsp/>-<nbsp/>[<nbsp/>1,<nbsp/>2,<nbsp/>4<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[3,<nbsp/>5]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="&lt;&lt;" ref="_lt_lt">
      <callseq>
        <obj>arr</obj> &lt;&lt; <obj>anObject</obj>
         <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
       Append---Pushes the given object on to the end of this array. This
       expression returns the array itself, so several appends
       may be chained together.
<p/>
       See also <cim><file>array</file><front>Array</front><back>push</back><mref>push</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[         [ 1, 2 ] << "c" << "d" << [ 3, 4 ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>2<nbsp/>]<nbsp/>&lt;&lt;<nbsp/>"c"<nbsp/>&lt;&lt;<nbsp/>"d"<nbsp/>&lt;&lt;<nbsp/>[<nbsp/>3,<nbsp/>4<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>"c",<nbsp/>"d",<nbsp/>[3,<nbsp/>4]]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="&lt;=&gt;" ref="_lt_eq_lt">
      <callseq>
        <obj>arr</obj> &lt;=&gt; <obj>anOtherArray</obj>
         <returns>-1, 0, +1</returns>
      </callseq>
      <desc>
<p/>
       Comparison---Returns an integer -1, 0,
       or +1 if this array is less than, equal to, or greater than
       <obj>anOtherArray</obj>.  Each object in each array is compared
       (using <meth>&lt;=&gt;</meth>). If any value isn't
       equal, then that inequality is the return value. If all the
       values found are equal, then the return is based on a
       comparison of the array lengths.  Thus, two arrays are
       ``equal'' according to <cim><file>array</file><front>Array</front><back>&lt;=&gt;</back><mref>_lt_eq_lt</mref></cim> if and only if they have
       the same length and the value of each element is equal to the
       value of the corresponding element in the other array.
<p/>
<codefragment>
<fullcode><![CDATA[         [ "a", "a", "c" ]    <=> [ "a", "b", "c" ] 
         [ 1, 2, 3, 4, 5, 6 ] <=> [ 1, 2 ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"a",<nbsp/>"c"<nbsp/>]<nbsp/><nbsp/><nbsp/><nbsp/>&lt;=&gt;<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>-1</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5,<nbsp/>6<nbsp/>]<nbsp/>&lt;=&gt;<nbsp/>[<nbsp/>1,<nbsp/>2<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>1</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="==" ref="_eq_eq">
      <callseq>
        <obj>arr</obj> == <obj>anOtherArray</obj>
         <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
       Equality---Two arrays are equal if they contain the same number
       of elements and if each element is equal to (according to
       <cim><file>object</file><front>Object</front><back>==</back><mref>_eq_eq</mref></cim>) the corresponding element in the other array.
<p/>
<codefragment>
<fullcode><![CDATA[         [ "a", "c" ]    == [ "a", "c", 7 ]
         [ "a", "c", 7 ] == [ "a", "c", 7 ]
         [ "a", "c", 7 ] == [ "a", "d", "f" ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"c"<nbsp/>]<nbsp/><nbsp/><nbsp/><nbsp/>==<nbsp/>[<nbsp/>"a",<nbsp/>"c",<nbsp/>7<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"c",<nbsp/>7<nbsp/>]<nbsp/>==<nbsp/>[<nbsp/>"a",<nbsp/>"c",<nbsp/>7<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"c",<nbsp/>7<nbsp/>]<nbsp/>==<nbsp/>[<nbsp/>"a",<nbsp/>"d",<nbsp/>"f"<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="===" ref="_eq_eq_eq">
      <callseq>
        <obj>arr</obj> === <obj>anOtherArray</obj>
         <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
       Case Equality---Equality as evaluated by <tt>case</tt>
       expressions. For arrays, this is the same as <cim><file>array</file><front>Array</front><back>==</back><mref>_eq_eq</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
         <method name="[ ]" ref="_ob_cb">
      <callseq>
                   <obj>arr</obj>[<obj>anInteger</obj>] 
              <returns><obj>anObject</obj> or <tt>nil</tt></returns><br/><obj>arr</obj>[<obj>start</obj>, <obj>length</obj>]
              <returns><obj>aSubArray</obj> or <tt>nil</tt></returns><br/><obj>arr</obj>[<obj>aRange</obj>] 
              <returns><obj>aSubArray</obj> or <tt>nil</tt></returns>
<p/>
      </callseq>
      <desc>
<p/>
     Element Reference---Returns the element at index <obj>anInteger</obj>,
     or returns a subarray starting at index <obj>start</obj> and
     continuing for <obj>length</obj> elements, or returns a subarray
     specified by <obj>aRange</obj>.
     Negative indices count backward from the end of the
     array (-1 is the last element). Returns <tt>nil</tt> if any indices
     are out of range.
<p/>
<codefragment>
<fullcode><![CDATA[         a = [ "a", "b", "c", "d", "e" ]
         a[2] +  a[0] + a[1]
         a[6]
         a[1, 2]
         a[1..3]
         a[4..7]
         a[6..10]
         a[-3, 3]
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a[2]<nbsp/>+<nbsp/><nbsp/>a[0]<nbsp/>+<nbsp/>a[1]</tt></td>
  <td>&#187;</td>
  <td><tt>"cab"</tt></td>
</tr>
<tr>
  <td><tt>a[6]</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a[1,<nbsp/>2]</tt></td>
  <td>&#187;</td>
  <td><tt>["b",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>a[1..3]</tt></td>
  <td>&#187;</td>
  <td><tt>["b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
<tr>
  <td><tt>a[4..7]</tt></td>
  <td>&#187;</td>
  <td><tt>["e"]</tt></td>
</tr>
<tr>
  <td><tt>a[6..10]</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a[-3,<nbsp/>3]</tt></td>
  <td>&#187;</td>
  <td><tt>["c",<nbsp/>"d",<nbsp/>"e"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="[ ]=" ref="_ob_cb_eq">
      <callseq>
                   <obj>arr</obj>[<obj>anInteger</obj>] = <obj>anObject</obj> <returns>
             <obj>anObject</obj> </returns> <br/><obj>arr</obj>[<obj>start</obj>, <obj>length</obj>] = <obj>aSubArray</obj>
           <returns> <obj>aSubArray</obj></returns> <br/><obj>arr</obj>[<obj>aRange</obj>] = <obj>aSubArray</obj> <returns> <obj>aSubArray</obj> 
             </returns>
      </callseq>
      <desc>
<p/>
       Element Assignment---Sets the element at index <obj>anInteger</obj>,
       or replaces a subarray starting at index <obj>start</obj> and
       continuing for <obj>length</obj> elements, or replaces a subarray
       specified by <obj>aRange</obj>.  If <obj>anInteger</obj> is greater than
       the current capacity of the array, the array grows
       automatically. A negative <obj>anInteger</obj> will count backward
       from the end of the array. Inserts elements if <obj>length</obj> is
       zero. If <obj>subArray</obj> is <tt>nil</tt>, deletes elements from <obj>arr</obj>.
       An <exception>IndexError</exception> is raised if a
       negative index points past the beginning of the array. See also
       <cim><file>array</file><front>Array</front><back>push</back><mref>push</mref></cim>, <cim><file>array</file><front>Array</front><back>unshift</back><mref>unshift</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[         a = Array.new
         a[4] = "4";                  a
         a[0, 3] = [ 'a', 'b', 'c' ]; a
         a[1..2] = [ 1, 2 ];          a
         a[0, 2] = "?";               a
         a[0..2] = "A";               a
         a[-1]   = "Z";               a
         a[1..-1] = nil;              a
]]></fullcode><rubycode>
<tr>
  <td><tt>a<nbsp/>=<nbsp/>Array.new</tt></td>
  <td>&#187;</td>
  <td><tt>[]</tt></td>
</tr>
<tr>
  <td><tt>a[4]<nbsp/>=<nbsp/>"4";<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>[nil,<nbsp/>nil,<nbsp/>nil,<nbsp/>nil,<nbsp/>"4"]</tt></td>
</tr>
<tr>
  <td><tt>a[0,<nbsp/>3]<nbsp/>=<nbsp/>[<nbsp/>'a',<nbsp/>'b',<nbsp/>'c'<nbsp/>];<nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>nil,<nbsp/>"4"]</tt></td>
</tr>
<tr>
  <td><tt>a[1..2]<nbsp/>=<nbsp/>[<nbsp/>1,<nbsp/>2<nbsp/>];<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>1,<nbsp/>2,<nbsp/>nil,<nbsp/>"4"]</tt></td>
</tr>
<tr>
  <td><tt>a[0,<nbsp/>2]<nbsp/>=<nbsp/>"?";<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["?",<nbsp/>2,<nbsp/>nil,<nbsp/>"4"]</tt></td>
</tr>
<tr>
  <td><tt>a[0..2]<nbsp/>=<nbsp/>"A";<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["A",<nbsp/>"4"]</tt></td>
</tr>
<tr>
  <td><tt>a[-1]<nbsp/><nbsp/><nbsp/>=<nbsp/>"Z";<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["A",<nbsp/>"Z"]</tt></td>
</tr>
<tr>
  <td><tt>a[1..-1]<nbsp/>=<nbsp/>nil;<nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/><nbsp/>a</tt></td>
  <td>&#187;</td>
  <td><tt>["A"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="|" ref="_ba">
      <callseq>
        <obj>arr</obj> | <obj>anOtherArray</obj>
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Set Union---Returns a new array by joining this array with
      <obj>anOtherArray</obj>, removing duplicates.
<p/>
<codefragment>
<fullcode><![CDATA[        [ "a", "b", "c" ] | [ "c", "d", "a" ]
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]<nbsp/>|<nbsp/>[<nbsp/>"c",<nbsp/>"d",<nbsp/>"a"<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="assoc" ref="assoc">
      <callseq>
        <obj>arr</obj>.assoc( <obj>anObject</obj> )
        <returns><obj>anArray</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
       Searches through an array whose elements are also arrays
       comparing <obj>anObject</obj> with the first element of each contained array
       using <obj>anObject</obj><tt>.==</tt> .
       Returns the first contained array that matches (that
       is, the first <em>assoc</em>iated array),
       or <tt>nil</tt> if no match is found.
       See also <cim><file>array</file><front>Array</front><back>rassoc</back><mref>rassoc</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[         s1 = [ "colors", "red", "blue", "green" ]
         s2 = [ "letters", "a", "b", "c" ]
         s3 = "foo"
         a  = [ s1, s2, s3 ]
         a.assoc("letters")
         a.assoc("foo")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>s1<nbsp/>=<nbsp/>[<nbsp/>"colors",<nbsp/>"red",<nbsp/>"blue",<nbsp/>"green"<nbsp/>]</tt></td>
</tr>
<tr>
<td colspan="3"><tt>s2<nbsp/>=<nbsp/>[<nbsp/>"letters",<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
<td colspan="3"><tt>s3<nbsp/>=<nbsp/>"foo"</tt></td>
</tr>
<tr>
<td colspan="3"><tt>a<nbsp/><nbsp/>=<nbsp/>[<nbsp/>s1,<nbsp/>s2,<nbsp/>s3<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.assoc("letters")</tt></td>
  <td>&#187;</td>
  <td><tt>["letters",<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>a.assoc("foo")</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="at" ref="at">
      <callseq>
        <obj>arr</obj>.at( <obj>anInteger</obj> ) 
         <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
       Returns the element at index <obj>anInteger</obj>.  A
       negative index counts from the end of <obj>arr</obj>.  Returns <tt>nil</tt>
       if the index is out of range. See also <cim><file>array</file><front>Array</front><back>[]</back><mref>_ob_cb</mref></cim>.
       (<cim><file>array</file><front>Array</front><back>at</back><mref>at</mref></cim> is slightly faster than <cim><file>array</file><front>Array</front><back>[]</back><mref>_ob_cb</mref></cim>, as it
       does not accept ranges and so on.)
<p/>
<codefragment>
<fullcode><![CDATA[         a = [ "a", "b", "c", "d", "e" ]
         a.at(0)
         a.at(-1)
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.at(0)</tt></td>
  <td>&#187;</td>
  <td><tt>"a"</tt></td>
</tr>
<tr>
  <td><tt>a.at(-1)</tt></td>
  <td>&#187;</td>
  <td><tt>"e"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="clear" ref="clear">
      <callseq>
        <obj>arr</obj>.clear
         <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
       Removes all elements from <obj>arr</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[         a = [ "a", "b", "c", "d", "e" ]
         a.clear
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.clear</tt></td>
  <td>&#187;</td>
  <td><tt>[]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="collect" ref="collect">
      <callseq>
        <obj>arr</obj>.collect <block>{| obj | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array by invoking <obj>block</obj> once for every
      element, passing each element as a parameter to <obj>block</obj>.  The
      result of <obj>block</obj> is used as the given element in the new
      array. See also <cim><file>array</file><front>Array</front><back>collect!</back><mref>collect_oh</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c", "d" ]
        a.collect {|x| x + "!" }
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.collect<nbsp/>{|x|<nbsp/>x<nbsp/>+<nbsp/>"!"<nbsp/>}</tt></td>
  <td>&#187;</td>
  <td><tt>["a!",<nbsp/>"b!",<nbsp/>"c!",<nbsp/>"d!"]</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="collect!" ref="collect_oh">
      <callseq>
        <obj>arr</obj>.collect! <block>{| obj | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Invokes <obj>block</obj> once for each element of <obj>arr</obj>, replacing the
      element with the value returned by <obj>block</obj>.
       See also <cim><file>array</file><front>Array</front><back>collect</back><mref>collect</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c", "d" ]
        a.collect! {|x| x + "!" }
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.collect!<nbsp/>{|x|<nbsp/>x<nbsp/>+<nbsp/>"!"<nbsp/>}</tt></td>
  <td>&#187;</td>
  <td><tt>["a!",<nbsp/>"b!",<nbsp/>"c!",<nbsp/>"d!"]</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a!",<nbsp/>"b!",<nbsp/>"c!",<nbsp/>"d!"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="compact" ref="compact">
      <callseq>
        <obj>arr</obj>.compact <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array based on the <obj>arr</obj> with
      all <tt>nil</tt> elements removed.
<p/>
<codefragment>
<fullcode><![CDATA[         [ "a", nil, "b", nil, "c", nil ].compact
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>nil,<nbsp/>"b",<nbsp/>nil,<nbsp/>"c",<nbsp/>nil<nbsp/>].compact</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="compact!" ref="compact_oh">
      <callseq>
        <obj>arr</obj>.compact! <returns><obj>arr</obj></returns> or <tt>nil</tt></callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>compact</back><mref>compact</mref></cim>, but modifies the receiver in place.  
      Returns <tt>nil</tt> if no changes were made.
<p/>
<codefragment>
<fullcode><![CDATA[         [ "a", nil, "b", nil, "c" ].compact!
         [ "a", "b", "c" ].compact!
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>nil,<nbsp/>"b",<nbsp/>nil,<nbsp/>"c"<nbsp/>].compact!</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].compact!</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="concat" ref="concat">
      <callseq>
        <obj>arr</obj>.concat( <obj>anOtherArray</obj> )
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Appends the elements in <obj>anOtherArray</obj> to <obj>arr</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[         [ "a", "b" ].concat( ["c", "d"] )
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b"<nbsp/>].concat(<nbsp/>["c",<nbsp/>"d"]<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="delete" ref="delete">
      <callseq>
        <obj>arr</obj>.delete( <obj>anObject</obj> )
        <returns><obj>anObject</obj> or <tt>nil</tt></returns> <br/><obj>arr</obj>.delete( <obj>anObject</obj> ) <block>{|  | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Deletes items from the self that are equal to <obj>anObject</obj>.
      If the item is not found, returns <tt>nil</tt>.  If the optional
      code block is given, returns the result of <obj>block</obj> if the item
      is not found. 
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "b", "b", "c" ]
        a.delete("b")
        a
        a.delete("z")
        a.delete("z") { "not found" }
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"b",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.delete("b")</tt></td>
  <td>&#187;</td>
  <td><tt>"b"</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>a.delete("z")</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a.delete("z")<nbsp/>{<nbsp/>"not<nbsp/>found"<nbsp/>}</tt></td>
  <td>&#187;</td>
  <td><tt>"not<nbsp/>found"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="delete_at" ref="delete_at">
      <callseq>
        <obj>arr</obj>.delete_at( <obj>anIndex</obj> )
        <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Deletes the element at the specified index, returning that
      element, or <tt>nil</tt> if the index is out of range.
      See also <cim><file>array</file><front>Array</front><back>slice!</back><mref>slice_oh</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = %w( ant bat cat dog )
        a.delete_at(2)
        a
        a.delete_at(99)
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>%w(<nbsp/>ant<nbsp/>bat<nbsp/>cat<nbsp/>dog<nbsp/>)</tt></td>
</tr>
<tr>
  <td><tt>a.delete_at(2)</tt></td>
  <td>&#187;</td>
  <td><tt>"cat"</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["ant",<nbsp/>"bat",<nbsp/>"dog"]</tt></td>
</tr>
<tr>
  <td><tt>a.delete_at(99)</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="delete_if" ref="delete_if">
      <callseq>
        <obj>arr</obj>.delete_if <block>{|  | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Deletes every element of <obj>arr</obj> for which <obj>block</obj>
      evaluates to <const>true</const>. 
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.delete_if {|x| x >= "b" }
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.delete_if<nbsp/>{|x|<nbsp/>x<nbsp/>&gt;=<nbsp/>"b"<nbsp/>}</tt></td>
  <td>&#187;</td>
  <td><tt>["a"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="each" ref="each">
      <callseq>
        <obj>arr</obj>.each <block>{| item | <blockbody>block</blockbody> }</block>
  <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Calls <obj>block</obj> once for each element in <obj>arr</obj>, passing that
      element as a parameter.
<p/>
<codefragment>
<alltt><fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.each {|x| print x, " -- " }
!-puts        
]]></fullcode>
a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]
a.each<nbsp/>{|x|<nbsp/>print<nbsp/>x,<nbsp/>"<nbsp/>--<nbsp/>"<nbsp/>}
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
a<nbsp/>--<nbsp/>b<nbsp/>--<nbsp/>c<nbsp/>--
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="each_index" ref="each_index">
      <callseq>
        <obj>arr</obj>.each_index <block>{| anIndex | <blockbody>block</blockbody> }</block>
 <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>each</back><mref>each</mref></cim>, but passes the index of the element instead of
      the element itself.
<p/>
<codefragment>
<alltt><fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.each_index {|x| print x, " -- " }
!-puts
]]></fullcode>
a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]
a.each_index<nbsp/>{|x|<nbsp/>print<nbsp/>x,<nbsp/>"<nbsp/>--<nbsp/>"<nbsp/>}
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
0<nbsp/>--<nbsp/>1<nbsp/>--<nbsp/>2<nbsp/>--
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="empty?" ref="empty_qm">
      <callseq>
        <obj>arr</obj>.empty? 
      <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if <obj>arr</obj> array contains no elements.
<p/>
<codefragment>
<fullcode><![CDATA[        [].empty?
]]></fullcode><rubycode>
<tr>
  <td><tt>[].empty?</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="eql?" ref="eql_qm">
      <callseq>
        <obj>arr</obj>.eql?( <obj>anOtherArray</obj> )
        <returns></returns><const>true</const> or <const>false</const></callseq>
      <desc>
<p/>
      An array is equal to another array if the lengths are equal and 
      each corresponding element is equal (according to
      <cim><file>object</file><front>Object</front><back>eql?</back><mref>eql_qm</mref></cim>).  See also <cim><file>array</file><front>Array</front><back>&lt;=&gt;</back><mref>_lt_eq_lt</mref></cim>.
      <tt>eql?</tt> is used for <classname>Hash</classname> comparison.
<p/>
<codefragment>
<fullcode><![CDATA[        [ "a", "b", "c" ].eql?(["a", "b", "c"])
        [ "a", "b", "c" ].eql?(["a", "b"])
        [ "a", "b", "c" ].eql?(["b", "c", "d"])
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].eql?(["a",<nbsp/>"b",<nbsp/>"c"])</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].eql?(["a",<nbsp/>"b"])</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].eql?(["b",<nbsp/>"c",<nbsp/>"d"])</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="fill" ref="fill">
      <callseq>
                  <obj>arr</obj>.fill( <obj>anObject</obj> ) <returns><obj>arr</obj></returns> <br/><obj>arr</obj>.fill( <obj>anObject</obj>, <obj>start</obj> <opt>, <obj>length</obj></opt>
          )  <returns><obj>arr</obj></returns> <br/><obj>arr</obj>.fill( <obj>anObject</obj>, <obj>aRange</obj> ) <returns><obj>arr</obj></returns>
<p/>
      </callseq>
      <desc>
<p/>
      Sets the selected elements of <obj>arr</obj> (which may be the entire array)
      to <obj>anObject</obj>. A <obj>start</obj> of <tt>nil</tt> is 
      equivalent to zero. A <obj>length</obj> of <tt>nil</tt> is equivalent to
      <obj>arr</obj>.length. 
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c", "d" ]
        a.fill("x")
        a.fill("z", 2, 2)
        a.fill("y", 0..1)
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.fill("x")</tt></td>
  <td>&#187;</td>
  <td><tt>["x",<nbsp/>"x",<nbsp/>"x",<nbsp/>"x"]</tt></td>
</tr>
<tr>
  <td><tt>a.fill("z",<nbsp/>2,<nbsp/>2)</tt></td>
  <td>&#187;</td>
  <td><tt>["x",<nbsp/>"x",<nbsp/>"z",<nbsp/>"z"]</tt></td>
</tr>
<tr>
  <td><tt>a.fill("y",<nbsp/>0..1)</tt></td>
  <td>&#187;</td>
  <td><tt>["y",<nbsp/>"y",<nbsp/>"z",<nbsp/>"z"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="first" ref="first">
      <callseq>
        <obj>arr</obj>.first <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns the first element of the array.  If the array is empty,
      returns <tt>nil</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "q", "r", "s", "t" ]
        a.first
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"q",<nbsp/>"r",<nbsp/>"s",<nbsp/>"t"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.first</tt></td>
  <td>&#187;</td>
  <td><tt>"q"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="flatten" ref="flatten">
      <callseq>
        <obj>arr</obj>.flatten <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array that is a one-dimensional flattening of this
      array (recursively). That is, for every element that is an 
      array, extract its elements into the new array.
<p/>
<codefragment>
<fullcode><![CDATA[        s = [ 1, 2, 3 ]
        t = [ 4, 5, 6, [7, 8] ]
        a = [ s, t, 9, 10 ]
        a.flatten
]]></fullcode><rubycode>
<tr>
  <td><tt>s<nbsp/>=<nbsp/>[<nbsp/>1,<nbsp/>2,<nbsp/>3<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3]</tt></td>
</tr>
<tr>
  <td><tt>t<nbsp/>=<nbsp/>[<nbsp/>4,<nbsp/>5,<nbsp/>6,<nbsp/>[7,<nbsp/>8]<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[4,<nbsp/>5,<nbsp/>6,<nbsp/>[7,<nbsp/>8]]</tt></td>
</tr>
<tr>
  <td><tt>a<nbsp/>=<nbsp/>[<nbsp/>s,<nbsp/>t,<nbsp/>9,<nbsp/>10<nbsp/>]</tt></td>
  <td>&#187;</td>
  <td><tt>[[1,<nbsp/>2,<nbsp/>3],<nbsp/>[4,<nbsp/>5,<nbsp/>6,<nbsp/>[7,<nbsp/>8]],<nbsp/>9,<nbsp/>10]</tt></td>
</tr>
<tr>
  <td><tt>a.flatten</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5,<nbsp/>6,<nbsp/>7,<nbsp/>8,<nbsp/>9,<nbsp/>10]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="flatten!" ref="flatten_oh">
      <callseq>
        <obj>arr</obj>.flatten! <returns><obj>arr</obj></returns> or <tt>nil</tt></callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>flatten</back><mref>flatten</mref></cim>, but modifies the receiver in place.
      Returns <tt>nil</tt> if no modifications were made (i.e., <obj>arr</obj>
      contains no subarrays.)
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ 1, 2, [3, [4, 5] ] ]
        a.flatten!
        a.flatten!
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>1,<nbsp/>2,<nbsp/>[3,<nbsp/>[4,<nbsp/>5]<nbsp/>]<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.flatten!</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5]</tt></td>
</tr>
<tr>
  <td><tt>a.flatten!</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>[1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="include?" ref="include_qm">
      <callseq>
        <obj>arr</obj>.include?( <obj>anObject</obj> ) 
        <returns><const>true</const> or <const>false</const></returns>
      </callseq>
      <desc>
<p/>
      Returns <const>true</const> if the given object
      is present in <obj>arr</obj> (that is, if any object <meth>==</meth>
      <obj>anObject</obj>), <const>false</const> otherwise.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.include?("b")
        a.include?("z")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.include?("b")</tt></td>
  <td>&#187;</td>
  <td><tt>true</tt></td>
</tr>
<tr>
  <td><tt>a.include?("z")</tt></td>
  <td>&#187;</td>
  <td><tt>false</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
    <figure type="table">
        <caption>Template characters for <cim><file>array</file><front>Array</front><back>pack</back><mref>pack</mref></cim></caption>
        <table>
<th>
  <td><b>Directive</b></td>
  <td><b>Meaning</b></td>
</th>
<tr>
  <td>@</td>
  <td>Moves to absolute position</td>
</tr>
<tr>
  <td>A</td>
  <td>ASCII string (space padded, count is width)</td>
</tr>
<tr>
  <td>a</td>
  <td>ASCII string (null padded, count is width)</td>
</tr>
<tr>
  <td>B</td>
  <td>Bit string (descending bit order)</td>
</tr>
<tr>
  <td>b</td>
  <td>Bit string (ascending bit order)</td>
</tr>
<tr>
  <td>C</td>
  <td>Unsigned char</td>
</tr>
<tr>
  <td>c</td>
  <td>Char</td>
</tr>
<tr>
  <td>d</td>
  <td>Double-precision float, native format</td>
</tr>
<tr>
  <td>E</td>
  <td>Double-precision float, little-endian byte order</td>
</tr>
<tr>
  <td>e</td>
  <td>Single-precision float, little-endian byte order</td>
</tr>
<tr>
  <td>f</td>
  <td>Single-precision float, native format</td>
</tr>
<tr>
  <td>G</td>
  <td>Double-precision float, network (big-endian) byte order</td>
</tr>
<tr>
  <td>g</td>
  <td>Single-precision float, network (big-endian) byte order</td>
</tr>
<tr>
  <td>H</td>
  <td>Hex string (high nibble first)</td>
</tr>
<tr>
  <td>h</td>
  <td>Hex string (low nibble first)</td>
</tr>
<tr>
  <td>I</td>
  <td>Unsigned integer</td>
</tr>
<tr>
  <td>i</td>
  <td>Integer</td>
</tr>
<tr>
  <td>L</td>
  <td>Unsigned long</td>
</tr>
<tr>
  <td>l</td>
  <td>Long</td>
</tr>
<tr>
  <td>M</td>
  <td>Quoted printable, MIME encoding (see RFC2045)</td>
</tr>
<tr>
  <td>m</td>
  <td>Base64 encoded string</td>
</tr>
<tr>
  <td>N</td>
  <td>Long, network (big-endian) byte order</td>
</tr>
<tr>
  <td>n</td>
  <td>Short, network (big-endian) byte-order</td>
</tr>
<tr>
  <td>P</td>
  <td>Pointer to a structure (fixed-length string)</td>
</tr>
<tr>
  <td>p</td>
  <td>Pointer to a null-terminated string</td>
</tr>
<tr>
  <td>S</td>
  <td>Unsigned short</td>
</tr>
<tr>
  <td>s</td>
  <td>Short</td>
</tr>
<tr>
  <td>U</td>
  <td>UTF-8</td>
</tr>
<tr>
  <td>u</td>
  <td>UU-encoded string</td>
</tr>
<tr>
  <td>V</td>
  <td>Long, little-endian byte order</td>
</tr>
<tr>
  <td>v</td>
  <td>Short, little-endian byte order</td>
</tr>
<tr>
  <td>X</td>
  <td>Back up a byte</td>
</tr>
<tr>
  <td>x</td>
  <td>Null byte</td>
</tr>
<tr>
  <td>Z</td>
  <td>Same as ``A''</td>
</tr>
<bottomrule/></table>
<p/>
      </figure>
<p/>
      </desc>
    </method>
<p/>
          <method name="index" ref="index">
      <callseq>
        <obj>arr</obj>.index( <obj>anObject</obj> )
        <returns><obj>anInteger</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns the index of the first object in <obj>arr</obj> such that
      the object <meth>==</meth> <obj>anObject</obj>.  Returns
      <tt>nil</tt> if no match is found.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.index("b")
        a.index("z")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.index("b")</tt></td>
  <td>&#187;</td>
  <td><tt>1</tt></td>
</tr>
<tr>
  <td><tt>a.index("z")</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="indexes" ref="indexes">
      <callseq>
        <obj>arr</obj>.indexes( <obj>i1, i2, ... iN</obj> )
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array consisting of elements at the given indices.
      May insert <tt>nil</tt> for indices out of range.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c", "d", "e", "f", "g" ]
        a.indexes(0, 2, 4)
        a.indexes(0, 2, 4, 12)
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e",<nbsp/>"f",<nbsp/>"g"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.indexes(0,<nbsp/>2,<nbsp/>4)</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"c",<nbsp/>"e"]</tt></td>
</tr>
<tr>
  <td><tt>a.indexes(0,<nbsp/>2,<nbsp/>4,<nbsp/>12)</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"c",<nbsp/>"e",<nbsp/>nil]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="indices" ref="indices">
      <callseq>
        <obj>arr</obj>.indices( <obj>i1, i2, ... iN</obj> )
        <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <cim><file>array</file><front>Array</front><back>indexes</back><mref>indexes</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
        <method name="join" ref="join">
      <callseq>
        <obj>arr</obj>.join( <obj>aSepString</obj>=<var>$,</var> )
        <returns><obj>aString</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a string created by converting each element of the array to a
      string, separated by <obj>aSepString</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[!-        a = [ "a", "b", "c" ]
        [ "a", "b", "c" ].join
        [ "a", "b", "c" ].join("-")
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].join</tt></td>
  <td>&#187;</td>
  <td><tt>"abc"</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].join("-")</tt></td>
  <td>&#187;</td>
  <td><tt>"a-b-c"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="last" ref="last">
      <callseq>
        <obj>arr</obj>.last <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns the last element of <obj>arr</obj>.  If the array is empty,
      returns <tt>nil</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[        [ "w", "x", "y", "z" ].last
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"w",<nbsp/>"x",<nbsp/>"y",<nbsp/>"z"<nbsp/>].last</tt></td>
  <td>&#187;</td>
  <td><tt>"z"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="length" ref="length">
      <callseq>
        <obj>arr</obj>.length <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns the number of elements in <obj>arr</obj>. May be zero.
<p/>
<codefragment>
<fullcode><![CDATA[        [ 1, 2, 3, 4, 5 ].length
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>2,<nbsp/>3,<nbsp/>4,<nbsp/>5<nbsp/>].length</tt></td>
  <td>&#187;</td>
  <td><tt>5</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="map!" ref="map_oh">
      <callseq>
        <obj>arr</obj>.map! <block>{| obj | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <cim><file>array</file><front>Array</front><back>collect!</back><mref>collect_oh</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
        <method name="nitems" ref="nitems">
      <callseq>
        <obj>arr</obj>.nitems <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns the number of non-<tt>nil</tt> elements in <obj>arr</obj>. May be zero.
<p/>
<codefragment>
<fullcode><![CDATA[        [ 1, nil, 3, nil, 5 ].nitems
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>1,<nbsp/>nil,<nbsp/>3,<nbsp/>nil,<nbsp/>5<nbsp/>].nitems</tt></td>
  <td>&#187;</td>
  <td><tt>3</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="pack" ref="pack">
      <callseq>
        <obj>arr</obj>.pack ( <obj>aTemplateString</obj> ) 
        <returns><obj>aBinaryString</obj></returns>
      </callseq>
      <desc>
                    Packs the contents of <obj>arr</obj> into a binary sequence according
      to the directives in <obj>aTemplateString</obj> (see Table
      22.1 on page 285). Directives ``A,'' ``a,'' and ``Z'' may be
      followed by a count, which gives the width of the resulting
      field. The remaining directives also may take a count,
      indicating the number of array elements to convert.  If the
      count is an asterisk (``<tt>*</tt>''), all remaining array elements
      will be converted. Any of the directives ``<tt>sSiIlL</tt>'' may be
      followed by an underscore (``<tt>_</tt>'') to use the underlying
      platform's native size for the specified type; otherwise, they
      use a platform-independent size.  Spaces are ignored in the
      template string. See also <cim><file>string</file><front>String</front><back>unpack</back><mref>unpack</mref></cim>
      on page 378.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        n = [ 65, 66, 67 ]
        a.pack("A3A3A3")
        a.pack("a3a3a3")
        n.pack("ccc")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
<td colspan="3"><tt>n<nbsp/>=<nbsp/>[<nbsp/>65,<nbsp/>66,<nbsp/>67<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.pack("A3A3A3")</tt></td>
  <td>&#187;</td>
  <td><tt>"a<visible_space/><visible_space/>b<visible_space/><visible_space/>c<visible_space/><visible_space/>"</tt></td>
</tr>
<tr>
  <td><tt>a.pack("a3a3a3")</tt></td>
  <td>&#187;</td>
  <td><tt>"a\000\000b\000\000c\000\000"</tt></td>
</tr>
<tr>
  <td><tt>n.pack("ccc")</tt></td>
  <td>&#187;</td>
  <td><tt>"ABC"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="pop" ref="pop">
      <callseq>
        <obj>arr</obj>.pop <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Removes the last element from <obj>arr</obj> and returns it, or
      <tt>nil</tt> if the array is empty (as with a stack).
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "m", "z" ]
        a.pop
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"m",<nbsp/>"z"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.pop</tt></td>
  <td>&#187;</td>
  <td><tt>"z"</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"m"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="push" ref="push">
      <callseq>
        <obj>arr</obj>.push( <optn><obj>anObject</obj></optn>  ) 
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Appends the given argument(s) to the end of <obj>arr</obj> (as with a
      stack).
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.push("d", "e", "f")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.push("d",<nbsp/>"e",<nbsp/>"f")</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e",<nbsp/>"f"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="rassoc" ref="rassoc">
      <callseq>
        <obj>arr</obj>.rassoc( <em>key</em> )
        <returns><obj>anArray</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Searches through the array whose elements are also arrays.
      Compares <em>key</em> with the second element of each contained
      array using <tt>==</tt>.  Returns the first contained array that
      matches.  See also <tt>assoc</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ [ 1, "one"], [2, "two"], [3, "three"], ["ii", "two"] ]
        a.rassoc("two")
        a.rassoc("four")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>[<nbsp/>1,<nbsp/>"one"],<nbsp/>[2,<nbsp/>"two"],<nbsp/>[3,<nbsp/>"three"],<nbsp/>["ii",<nbsp/>"two"]<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.rassoc("two")</tt></td>
  <td>&#187;</td>
  <td><tt>[2,<nbsp/>"two"]</tt></td>
</tr>
<tr>
  <td><tt>a.rassoc("four")</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="reject!" ref="reject_oh">
      <callseq>
        <obj>arr</obj>.reject! <block>{|  | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>arr</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
    Equivalent to <cim><file>array</file><front>Array</front><back>delete_if</back><mref>delete_if</mref></cim>, but returns <tt>nil</tt> if no
    changes were made.
<p/>
      </desc>
    </method>
<p/>
        <method name="replace" ref="replace">
      <callseq>
        <obj>arr</obj>.replace( <obj>anOtherArray</obj> )
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Replaces the contents of <obj>arr</obj> with the contents of
      <obj>anOtherArray</obj>, truncating or expanding if necessary.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c", "d", "e" ]
        a.replace( [ "x", "y", "z" ] )
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.replace(<nbsp/>[<nbsp/>"x",<nbsp/>"y",<nbsp/>"z"<nbsp/>]<nbsp/>)</tt></td>
  <td>&#187;</td>
  <td><tt>["x",<nbsp/>"y",<nbsp/>"z"]</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["x",<nbsp/>"y",<nbsp/>"z"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="reverse" ref="reverse">
      <callseq>
        <obj>arr</obj>.reverse <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array using <obj>arr</obj>'s elements in reverse order.
<p/>
<codefragment>
<fullcode><![CDATA[        [ "a", "b", "c" ].reverse
        [ 1 ].reverse
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>].reverse</tt></td>
  <td>&#187;</td>
  <td><tt>["c",<nbsp/>"b",<nbsp/>"a"]</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>1<nbsp/>].reverse</tt></td>
  <td>&#187;</td>
  <td><tt>[1]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="reverse!" ref="reverse_oh">
      <callseq>
        <obj>arr</obj>.reverse! <returns><obj>arr</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Same as <meth>reverse</meth>, but returns <tt>nil</tt> if
      <obj>arr</obj> is unchanged (<obj>arr</obj><meth>.length</meth> is zero or one).
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.reverse!
        a
        [ 1 ].reverse!
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.reverse!</tt></td>
  <td>&#187;</td>
  <td><tt>["c",<nbsp/>"b",<nbsp/>"a"]</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["c",<nbsp/>"b",<nbsp/>"a"]</tt></td>
</tr>
<tr>
  <td><tt>[<nbsp/>1<nbsp/>].reverse!</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="reverse_each" ref="reverse_each">
      <callseq>
        <obj>arr</obj>.reverse_each <block>{|  | <blockbody>block</blockbody> }</block>
<p/>
      </callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>each</back><mref>each</mref></cim>, but traverses <obj>arr</obj> in reverse order.
<p/>
<codefragment>
<alltt><fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.reverse_each {|x| print x, " " }
!-puts
]]></fullcode>
a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]
a.reverse_each<nbsp/>{|x|<nbsp/>print<nbsp/>x,<nbsp/>"<nbsp/>"<nbsp/>}
</alltt>
</codefragment>
<em>produces:</em>
<codefragment><alltt>
c<nbsp/>b<nbsp/>a
</alltt>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="rindex" ref="rindex">
      <callseq>
        <obj>arr</obj>.rindex( <obj>anObject</obj> )
        <returns><obj>anInteger</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns the index of the last object in <obj>arr</obj> such that
      the object <meth>==</meth> <obj>anObject</obj>.  Returns 
      <tt>nil</tt> if no match is found.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "b", "b", "c" ]
        a.rindex("b")
        a.rindex("z")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"b",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.rindex("b")</tt></td>
  <td>&#187;</td>
  <td><tt>3</tt></td>
</tr>
<tr>
  <td><tt>a.rindex("z")</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="shift" ref="shift">
      <callseq>
        <obj>arr</obj>.shift <returns><obj>anObject</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Returns the first element of <obj>arr</obj> and removes it (shifting
      all other elements down by one).  Returns <tt>nil</tt> if the array
      is empty.
<p/>
<codefragment>
<fullcode><![CDATA[        args = [ "-m", "-q", "filename" ]
        args.shift
        args
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>args<nbsp/>=<nbsp/>[<nbsp/>"-m",<nbsp/>"-q",<nbsp/>"filename"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>args.shift</tt></td>
  <td>&#187;</td>
  <td><tt>"-m"</tt></td>
</tr>
<tr>
  <td><tt>args</tt></td>
  <td>&#187;</td>
  <td><tt>["-q",<nbsp/>"filename"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="size" ref="size">
      <callseq>
        <obj>arr</obj>.size <returns><obj>anInteger</obj></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <cim><file>array</file><front>Array</front><back>length</back><mref>length</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
        <method name="slice" ref="slice">
      <callseq>
                   <obj>arr</obj>.slice( <obj>anInteger</obj> ) 
              <returns><obj>anObject</obj></returns><br/><obj>arr</obj>.slice( <obj>start</obj>, <obj>length</obj> )
              <returns><obj>aSubArray</obj></returns><br/><obj>arr</obj>.slice( <obj>aRange</obj> )
              <returns><obj>aSubArray</obj></returns>
<p/>
      </callseq>
      <desc>
<p/>
     Synonym for <cim><file>array</file><front>Array</front><back>[ ]</back><mref>_ob_cb</mref></cim>.
<p/>
<codefragment>
<fullcode><![CDATA[         a = [ "a", "b", "c", "d", "e" ]
         a.slice(2) + a.slice(0) + a.slice(1)
         a.slice(6)
         a.slice(1, 2)
         a.slice(1..3)
         a.slice(4..7)
         a.slice(6..10)
         a.slice(-3, 3)
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.slice(2)<nbsp/>+<nbsp/>a.slice(0)<nbsp/>+<nbsp/>a.slice(1)</tt></td>
  <td>&#187;</td>
  <td><tt>"cab"</tt></td>
</tr>
<tr>
  <td><tt>a.slice(6)</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a.slice(1,<nbsp/>2)</tt></td>
  <td>&#187;</td>
  <td><tt>["b",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>a.slice(1..3)</tt></td>
  <td>&#187;</td>
  <td><tt>["b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
<tr>
  <td><tt>a.slice(4..7)</tt></td>
  <td>&#187;</td>
  <td><tt>["e"]</tt></td>
</tr>
<tr>
  <td><tt>a.slice(6..10)</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a.slice(-3,<nbsp/>3)</tt></td>
  <td>&#187;</td>
  <td><tt>["c",<nbsp/>"d",<nbsp/>"e"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
         <method name="slice!" ref="slice_oh">
      <callseq>
                   <obj>arr</obj>.slice!( <obj>anInteger</obj> )
              <returns><obj>anObject</obj> or <tt>nil</tt></returns><br/><obj>arr</obj>.slice!( <obj>start</obj>, <obj>length</obj> )
              <returns><obj>aSubArray</obj> or <tt>nil</tt></returns><br/><obj>arr</obj>.slice!( <obj>aRange</obj> )
              <returns><obj>aSubArray</obj> or <tt>nil</tt></returns>
<p/>
      </callseq>
      <desc>
<p/>
      Deletes the element(s)  given by an index (optionally with a
      length) or by a range. Returns the deleted object, subarray, or
      <tt>nil</tt> if the index is out of range. Equivalent to:
<p/>
<codefragment>
<alltt><fullcode><![CDATA[        def slice!(*args)
          result = self[*args]
          self[*args] = nil
          result
        end
]]></fullcode>
def<nbsp/>slice!(*args)
<nbsp/><nbsp/>result<nbsp/>=<nbsp/>self[*args]
<nbsp/><nbsp/>self[*args]<nbsp/>=<nbsp/>nil
<nbsp/><nbsp/>result
end
</alltt>
</codefragment>
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "b", "c" ]
        a.slice!(1)
        a
        a.slice!(-1)
        a
        a.slice!(100)
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.slice!(1)</tt></td>
  <td>&#187;</td>
  <td><tt>"b"</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"c"]</tt></td>
</tr>
<tr>
  <td><tt>a.slice!(-1)</tt></td>
  <td>&#187;</td>
  <td><tt>"c"</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a"]</tt></td>
</tr>
<tr>
  <td><tt>a.slice!(100)</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="sort" ref="sort">
      <callseq>
        <obj>arr</obj>.sort 
        <returns><obj>anArray</obj></returns> <br/><obj>arr</obj>.sort <block>{| a,b | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>anArray</obj></returns>
<p/>
      </callseq>
      <desc>
<p/>
            Returns a new array created by sorting <obj>arr</obj>.  Comparisons
      for the sort will be done using the <tt>&lt;=&gt;</tt> operator or using an optional
      code block. The block implements a comparison between
  <obj>a</obj> and <obj>b</obj>, returning -1, 0, or +1.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "d", "a", "e", "c", "b" ]
        a.sort
        a.sort {|x,y| y <=> x }
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"d",<nbsp/>"a",<nbsp/>"e",<nbsp/>"c",<nbsp/>"b"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.sort</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"]</tt></td>
</tr>
<tr>
  <td><tt>a.sort<nbsp/>{|x,y|<nbsp/>y<nbsp/>&lt;=&gt;<nbsp/>x<nbsp/>}</tt></td>
  <td>&#187;</td>
  <td><tt>["e",<nbsp/>"d",<nbsp/>"c",<nbsp/>"b",<nbsp/>"a"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="sort!" ref="sort_oh">
      <callseq>
        <obj>arr</obj>.sort!
        <returns><obj>arr</obj></returns> <br/><obj>arr</obj>.sort! <block>{| a,b | <blockbody>block</blockbody> }</block>
<p/>
        <returns><obj>arr</obj></returns>
<p/>
      </callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>sort</back><mref>sort</mref></cim>, but modifies the receiver in place.
      <obj>arr</obj> is effectively frozen while a sort is in progress.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "d", "a", "e", "c", "b" ]
        a.sort!
        a
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"d",<nbsp/>"a",<nbsp/>"e",<nbsp/>"c",<nbsp/>"b"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.sort!</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"]</tt></td>
</tr>
<tr>
  <td><tt>a</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d",<nbsp/>"e"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="to_a" ref="to_a">
      <callseq>
        <obj>arr</obj>.to_a <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns <obj>arr</obj>.
<p/>
      </desc>
    </method>
<p/>
        <method name="to_ary" ref="to_ary">
      <callseq>
        <obj>arr</obj>.to_ary <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Synonym for <cim><file>array</file><front>Array</front><back>to_a</back><mref>to_a</mref></cim>.
<p/>
      </desc>
    </method>
<p/>
        <method name="to_s" ref="to_s">
      <callseq>
        <obj>arr</obj>.to_s <returns><obj>aString</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns <obj>arr</obj><tt>.join</tt>.
<p/>
<codefragment>
<fullcode><![CDATA[        [ "a", "e", "i", "o" ].to_s
]]></fullcode><rubycode>
<tr>
  <td><tt>[<nbsp/>"a",<nbsp/>"e",<nbsp/>"i",<nbsp/>"o"<nbsp/>].to_s</tt></td>
  <td>&#187;</td>
  <td><tt>"aeio"</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="uniq" ref="uniq">
      <callseq>
        <obj>arr</obj>.uniq <returns><obj>anArray</obj></returns>
      </callseq>
      <desc>
<p/>
      Returns a new array by removing duplicate values in <obj>arr</obj>.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "a", "b", "b", "c" ]
        a.uniq
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"a",<nbsp/>"b",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.uniq</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="uniq!" ref="uniq_oh">
      <callseq>
        <obj>arr</obj>.uniq! <returns><obj>arr</obj> or <tt>nil</tt></returns>
      </callseq>
      <desc>
<p/>
      Same as <cim><file>array</file><front>Array</front><back>uniq</back><mref>uniq</mref></cim>, but modifies the receiver in place.
      Returns <tt>nil</tt> if no changes are made (that is, no duplicates
      are found).
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "a", "a", "b", "b", "c" ]
        a.uniq!
        b = [ "a", "b", "c" ]
        b.uniq!
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"a",<nbsp/>"b",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.uniq!</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c"]</tt></td>
</tr>
<tr>
<td colspan="3"><tt>b<nbsp/>=<nbsp/>[<nbsp/>"a",<nbsp/>"b",<nbsp/>"c"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>b.uniq!</tt></td>
  <td>&#187;</td>
  <td><tt>nil</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
        <method name="unshift" ref="unshift">
      <callseq>
        <obj>arr</obj>.unshift( <obj>anObject</obj> )
        <returns><obj>arr</obj></returns>
      </callseq>
      <desc>
<p/>
      Prepends <obj>anObject</obj> to the front of <obj>arr</obj>, and shifts all
      other elements up one.
<p/>
<codefragment>
<fullcode><![CDATA[        a = [ "b", "c", "d" ]
        a.unshift("a")
]]></fullcode><rubycode>
<tr>
<td colspan="3"><tt>a<nbsp/>=<nbsp/>[<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"<nbsp/>]</tt></td>
</tr>
<tr>
  <td><tt>a.unshift("a")</tt></td>
  <td>&#187;</td>
  <td><tt>["a",<nbsp/>"b",<nbsp/>"c",<nbsp/>"d"]</tt></td>
</tr>
</rubycode>
<p/>
</codefragment>
<p/>
      </desc>
    </method>
<p/>
  </methods>
<p/>
</class>
</ppdoc>
