Searching for [Int] -> (Int -> Bool) -> ([Int], [Int])

Preludebreak :: (a -> Bool) -> [a] -> ([a], [a])
base
break, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list:

> break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
> break (< 9) [1,2,3] == ([],[1,2,3])
> break (> 9) [1,2,3] == ([1,2,3],[])

break p is equivalent to span (not . p).
Preludespan :: (a -> Bool) -> [a] -> ([a], [a])
base
span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that satisfy p and second element is the remainder of the list:

> span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
> span (< 9) [1,2,3] == ([1,2,3],[])
> span (< 0) [1,2,3] == ([],[1,2,3])

span p xs is equivalent to (takeWhile p xs, dropWhile p xs)
Data.Listbreak :: (a -> Bool) -> [a] -> ([a], [a])
base
break, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that do not satisfy p and second element is the remainder of the list:

> break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
> break (< 9) [1,2,3] == ([],[1,2,3])
> break (> 9) [1,2,3] == ([1,2,3],[])

break p is equivalent to span (not . p).
Data.Listpartition :: (a -> Bool) -> [a] -> ([a], [a])
base
The partition function takes a predicate a list and returns the pair of lists of elements which do and do not satisfy the predicate, respectively; i.e.,

> partition p xs == (filter p xs, filter (not . p) xs)
Data.Listspan :: (a -> Bool) -> [a] -> ([a], [a])
base
span, applied to a predicate p and a list xs, returns a tuple where first element is longest prefix (possibly empty) of xs of elements that satisfy p and second element is the remainder of the list:

> span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
> span (< 9) [1,2,3] == ([1,2,3],[])
> span (< 0) [1,2,3] == ([],[1,2,3])

span p xs is equivalent to (takeWhile p xs, dropWhile p xs)