15 lines
435 B
Haskell
15 lines
435 B
Haskell
module Utils where
|
|
|
|
|
|
symbolic = (`elem` symbolic_ops)
|
|
symbolic_ops = "!@#$%^&*+./<=>?\\^|:-~"
|
|
|
|
-- doing 'partition f xs = (filter f xs, filter (not . f) xs)' is too
|
|
-- slow, cuz it would run same test twice on every paramter. I might
|
|
-- be wrong tho
|
|
partition :: (a -> Bool) -> [a] -> ([a], [a])
|
|
partition _ [] = ([], [])
|
|
partition f (x:xs)
|
|
| f x = (x:pass, fail)
|
|
| otherwise = (pass, x:fail)
|
|
where (pass, fail) = partition f xs
|