@@ -8226,54 +8226,73 @@ rb_ary_deconstruct(VALUE ary)
82268226}
82278227
82288228/*
8229- * An array is an ordered, integer-indexed collection of objects, called _elements_.
8230- * Any object (even another array) may be an array element,
8231- * and an array can contain objects of different types.
8229+ * An \Array object is an ordered, integer-indexed collection of objects,
8230+ * called _elements_;
8231+ * the object represents
8232+ * an {array data structure}[https://en.wikipedia.org/wiki/Array_(data_structure)].
8233+ *
8234+ * An element may be any object (even another array);
8235+ * elements may be any mixture of objects of different types.
8236+ *
8237+ * Important data structures that use arrays include:
8238+ *
8239+ * - {Coordinate vector}[https://en.wikipedia.org/wiki/Coordinate_vector].
8240+ * - {Matrix}[https://en.wikipedia.org/wiki/Matrix_(mathematics)].
8241+ * - {Heap}[https://en.wikipedia.org/wiki/Heap_(data_structure)].
8242+ * - {Hash table}[https://en.wikipedia.org/wiki/Hash_table].
8243+ * - {Deque (double-ended queue)}[https://en.wikipedia.org/wiki/Double-ended_queue].
8244+ * - {Queue}[https://en.wikipedia.org/wiki/Queue_(abstract_data_type)].
8245+ * - {Stack}[https://en.wikipedia.org/wiki/Stack_(abstract_data_type)].
8246+ *
8247+ * There are also array-like data structures:
8248+ *
8249+ * - {Associative array}[https://en.wikipedia.org/wiki/Associative_array] (see Hash).
8250+ * - {Directory}[https://en.wikipedia.org/wiki/Directory_(computing)] (see Dir).
8251+ * - {Environment}[https://en.wikipedia.org/wiki/Environment_variable] (see ENV).
8252+ * - {Set}[https://en.wikipedia.org/wiki/Set_(abstract_data_type)] (see Set).
8253+ * - {String}[https://en.wikipedia.org/wiki/String_(computer_science)] (see String).
82328254 *
82338255 * == \Array Indexes
82348256 *
8235- * \Array indexing begins at zero , as in C or Java.
8257+ * \Array indexing starts at 0 , as in C or Java.
82368258 *
8237- * A non-negative index is an offset from the beginning of the array :
8259+ * A non-negative index is an offset from the first element :
82388260 *
8239- * a = ['a', 'b', 'c', 'd']
8240- * a[0] # => "a"
8241- * a[1] # => "b"
8261+ * - Index 0 indicates the first element.
8262+ * - Index 1 indicates the second element.
8263+ * - ...
82428264 *
82438265 * A negative index is an offset, backwards, from the end of the array:
82448266 *
8245- * a[-1] # => "d"
8246- * a[-2] # => "c"
8267+ * - Index -1 indicates the last element.
8268+ * - Index -2 indicates the next-to-last element.
8269+ * - ...
82478270 *
8248- * === \Range of an \Array
82498271 *
8250- * A non-negative index is <i>in-range</i> if it is smaller than the size of the array,
8251- * <i>out-of-range</i> otherwise:
8272+ * === In-Range and Out-of-Range Indexes
82528273 *
8253- * a.size # => 4
8254- * a[3] # => "d"
8255- * a[4] # => nil
8274+ * A non-negative index is <i>in range</i> if and only if it is smaller than
8275+ * the size of the array. For a 3-element array:
82568276 *
8257- * A negative index is <i>in-range</i> if its absolute value is
8258- * not larger than the size of the array,
8259- * <i>out-of-range</i> otherwise:
8277+ * - Indexes 0 through 2 are in range.
8278+ * - Index 3 is out of range.
82608279 *
8261- * a[-4] # => "a"
8262- * a[-5] # => nil
8280+ * A negative index is <i>in range</i> if and only if its absolute value is
8281+ * not larger than the size of the array. For a 3-element array:
8282+ *
8283+ * - Indexes -1 through -3 are in range.
8284+ * - Index -4 is out of range.
82638285 *
82648286 * === Effective Index
82658287 *
82668288 * Although the effective index into an array is always an integer,
8267- * some methods (both within and outside of class +Array+)
8268- * accept non-integer arguments that are
8269- * {integer-convertible objects}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects]:
8270- *
8271- * a[1.9] # => "b"
8272- * a[-1.9] # => "d"
8289+ * some methods (both within class \Array and elsewhere)
8290+ * accept one or more non-integer arguments that are
8291+ * {integer-convertible objects}[rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects].
82738292 *
82748293 * == Creating Arrays
82758294 *
8276- * You can create an + Array+ object explicitly with:
8295+ * You can create an \ Array object explicitly with:
82778296 *
82788297 * - An {array literal}[rdoc-ref:literals.rdoc@Array+Literals]:
82798298 *
0 commit comments