From: jweirich@... Date: 2000-10-20T14:15:14+09:00 Subject: [ruby-talk:5700] Re: Array#insert >>>>> "Mark" == Mark Slagell writes: >> I would prefer that using -1 would result in: >> >> [1, 2, 3, [4, 5]] Mark> But it muddies the semantics, right? "insert before" for Mark> non-negative indices, "insert after" for negative. Don't think of it as "insert before" or "insert after". Think of it as "insert at". After the assertion, the inserted value will be *at* the given index. E.g. After ... a.insert (index, value) then ... a[index] == value whether index is positive or negative. BTW, shouldn't the method be named "insert!" ? -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)