From 18a639eb460d7581a5dd594a50eb236ae7675685 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Tue, 17 Mar 2015 14:33:20 +0800 Subject: +16 +17 +18 +19 --- h18.hs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 h18.hs (limited to 'h18.hs') diff --git a/h18.hs b/h18.hs new file mode 100644 index 0000000..b9e8192 --- /dev/null +++ b/h18.hs @@ -0,0 +1,7 @@ +slice :: [a] -> Int -> Int -> [a] +slice (x:xs) a b + | a > 1 = slice xs (a-1) (b-1) + | a <= 1 && b >= 1 = x:(slice xs (a-1) (b-1)) + | otherwise = [] + +slice' xs i j = [x | (x,k)<- (zip xs [1..j]) , k >= i] -- cgit v1.2.3-70-g09d2