summaryrefslogtreecommitdiff
path: root/H19.hs
diff options
context:
space:
mode:
Diffstat (limited to 'H19.hs')
-rw-r--r--H19.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/H19.hs b/H19.hs
new file mode 100644
index 0000000..45c5a07
--- /dev/null
+++ b/H19.hs
@@ -0,0 +1,6 @@
+rotate :: [a] -> Int -> [a]
+rotate xs c
+ | c < 0 = rotate xs (c + (length xs))
+ | otherwise = (drop (c `mod` (length xs)) xs ) ++ (take (c `mod` (length xs)) xs)
+
+rotate' xs c = take (length xs) $ drop (length xs + c) $ cycle xs