Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: c22582cbeb
Fetching contributors…

Cannot retrieve contributors at this time

11 lines (9 sloc) 0.292 kB
rotate xs n
| null xs || n == 0 = xs
| n > 0 = rotate ( (tail xs)++[head xs] ) ( n - 1 )
| n < 0 = rotate ( (last xs): (init xs) ) ( n + 1 )
rotate' xs n
| n >= 0 =
let (fst, snd) = splitAt n xs
in snd ++ fst
| otherwise = rotate xs (n `mod` (length xs))
Jump to Line
Something went wrong with that request. Please try again.