Clamps Dictionary
rotate
Function
(rotate list &optional (num 1))
Rotate list by num elems (to the right). num can be negative. If num is larger than the list size it will wrap around as if the rotation was called recursively num times.
Arguments
list |
List to rotate |
num |
Integer number of rotations. |
Examples
(rotate '(dog bird lion cat horse) 1) ; => (horse dog bird lion cat) (rotate '(dog bird lion cat horse) -1) ; => (bird lion cat horse dog) (rotate '(dog bird lion cat horse) 4733) ; => (lion cat horse dog bird)
Created: 2025-02-18 Di 12:58