Switch parameters order
This commit is contained in:
parent
95e0a5732e
commit
ac5831f063
10
Alea/List.hs
10
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
|
||||
|
Loading…
Reference in New Issue
Block a user