From: Robert Klemme Date: 2004-01-16T17:36:45+09:00 Subject: Re: Getting the tail of a list? "Dave Brown" schrieb im Newsbeitrag news:cio6ub.3h9.ln@lart.ca... > In article <4005AC05.90007@hypermetrics.com>, > Hal Fulton wrote: > : Dave Brown wrote: > : > In article <20040114130426.GA15734@mlabdial.hit.bme.hu>, > : > KONTRA Gergely wrote: > : > : On 0113, Robert Klemme wrote: > : > : > > Whups, never mind, that doesn't work. :) > : > : > > : > : > But this does: > : > : > > : > : > irb(main):001:0> a=[1,2,3,4] > : > : > => [1, 2, 3, 4] > : > : > irb(main):002:0> a[1,a.length] > : > : > => [2, 3, 4] > : > : > > : > : > The second parameter is the length. Simply using a.length is sufficient > : > : > since then all elements to the end are used. > : > : > : > : I _would like to_ write a[2,Infinity], or something like that... > : > > : > a[1,-1] > : > : :) "Error: Cycle detected in ruby-talk thread" > : > : Read again. Robert's point was that this doesn't work. The second > : parameter is a length, and a length of -1 gives you nil. > > D'oh. > > That's what I get for not firing up irb. > > a[1..-1] is what I actually meant. > > --Dave Error: Cycle detected in ruby-talk thread cycle. Bailing out. a[1..-1] was proposed already. :-)) Nevermind, 't was fun. robert