Is there a function that cycles the list as follows?

cycle([1,2,3,4,5,6],2) -> [5,6,1,2,3,4]
cycle([1,2,3,4,5,6],-2) -> [3,4,5,6,1,2]
cycle([1,2,3,4,5,6],0) -> [1,2,3,4,5,6]

Reply via email to