[Tutor] cyclically rotate a list.

Paul Sidorsky paulsid@shaw.ca
Thu, 14 Feb 2002 00:37:46 -0700


kevin parks wrote:

> How does one cyclically rotate a list (of arbitary size)
> so that given a list x= [0, 1, 2, 3, 4, 5, 6] one could say:
> rotate(x, y=0) -->[0, 1, 2, 3, 4, 5, 6]
> rotate(x, y=1) -->[1, 2, 3, 4, 5, 6, 0]

This came up on the big group not too long ago.  Check the thread
below.  (Hope the URL doesn't get split - it should be all together on
one line.)

http://groups.google.ca/groups?hl=en&frame=right&th=984bc5ace40c2f12&seekm=a2mf02%2486k%241%40serv1.iunet.it#link1

-- 
======================================================================
Paul Sidorsky                                          Calgary, Canada
paulsid@shaw.ca                        http://members.shaw.ca/paulsid/