From: matt@... (matt neuburg) Date: 2009-04-04T13:19:40+09:00 Subject: Re: Array#insert with negative index Eric Hodel wrote: > On Apr 3, 2009, at 15:09, matt neuburg wrote: > > Eric Hodel wrote: > >> On Apr 3, 2009, at 12:49, matt neuburg wrote: > >> > >>> p [1,2,3].insert(-1, "howdy") > >>> #=> [1, 2, 3, "howdy"] > >>> > >>> Docs: "Inserts the given values before the element with the given > >>> index > >>> (which may be negative)." > >>> > >>> The element with index -1 is 3, the last item. Before is before. I > >>> have > >>> a feeling, though, that what's meant here is that when the index is > >>> negative, before means after (perhaps because we're looking at the > >>> array > >>> from the other end, as it were). Is that right? > > > They indicate the insertion point for Array#insert Cool, I'll buy that, but it is certainly not what the docs say (as quoted above). I take it no one thinks this is worth filing a bug over... Thx - m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com