Switch parameters order

This commit is contained in:
Rnhmjoj 2014-10-16 23:00:52 +02:00
parent 95e0a5732e
commit ac5831f063

View File

@ -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