[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Circular shift

7stud --

1/22/2008 7:46:00 PM

Zangief Ief wrote:
> Hello everybody,
>
> I would like to write a simple implementation of *circular shift*
> (http://en.wikipedia.org/wiki/Circ...). Thank you all for any
> ideas :)

arr = [1, 2, 3]
arr << arr.shift
p arr

arr[0, 0] = arr.pop
p arr

--output:--
[2, 3, 1]
[1, 2, 3]
--
Posted via http://www.ruby-....