You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

10 lines
309 B

{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- Rotate a list N places to the left.
-- Hint: Use the predefined functions length and (++).
rotate xs n | n >= 0 = drop n xs ++ take n xs
| n < 0 = drop len xs ++ take len xs
where len = n+length xs