From ac5831f06388f930fed0527383012a448f357b5d Mon Sep 17 00:00:00 2001 From: Rnhmjoj Date: Thu, 16 Oct 2014 23:00:52 +0200 Subject: [PATCH] Switch parameters order --- Alea/List.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Alea/List.hs b/Alea/List.hs index b27779c..e71ae76 100644 --- a/Alea/List.hs +++ b/Alea/List.hs @@ -6,11 +6,11 @@ removeAt :: Int -> [a] -> (a, [a]) removeAt n xs = (xs !! n, take n xs ++ drop (n+1) xs) -- Split a list into a list of lists --- ex. split "ab,cd,ef" ',' == ["ab","cd","ef"] -split :: (Eq a) => [a] -> a -> [[a]] -split [] _ = [[]] -split (c:cs) delim +-- ex. split ',' "ab,cd,ef" == ["ab","cd","ef"] +split :: (Eq a) => a -> [a] -> [[a]] +split _ [] = [[]] +split delim (c:cs) | c == delim = [] : rest | otherwise = (c : head rest) : tail rest where - rest = split cs delim + rest = split delim cs