At 04:05 12/06/2004 +0900, you wrote: >Hi, > >On 11.06.2004, at 18:23, Charles Comstock wrote: >>I don't want a destructive function. A number of times I have used the shift >>and the remainder, but there are a number of times you want a non destructive >>copy of the rest of the list. Hence rest ;p > >If you don't want to destroy the original list you can use the splat operator >in an assignment: > >a = [ 1, 2, 3, 4 ] ># => [1, 2, 3, 4] >first, *rest = a ># => [1, 2, 3, 4] >first ># => 1 >rest ># => [2, 3, 4] > >Florian Frank Nice! And probably efficient too. That is an often overlooked feature of ruby. It somehow reminds me of Prolog: ([First|Tail], A). Free/Bound variables is a missing concept in Ruby today (not talking about backtracking). I am working on that (the former, matching). Yours, JeanHuguesRobert ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17