partition


partition(f, xs)
      

Return a pair of lists. The first list contain the elements of xs for which f returned true and the second list contain the elements of xs for which f returned false.

The predicate f should accept one argument and return a single value. It should not modify xs. The elements of the returned lists appear in the same order as they appeared in the original list.

Examples:


let os:es = partition(is_odd, [1, 2, 3, 4, 5])
os
// [1, 3, 5]
es
// [2, 4]
      

Also see:

filter
map
zip


Core Module Index | Contents