Elm

Other Elm solutions.
module Strain exposing (discard, keep)


keep : (a -> Bool) -> List a -> List a
keep predicate items =
    case items of
        [] ->
            []

        x :: xs ->
            let
                rest =
                    keep predicate xs

                result =
                    if predicate x then
                        x :: rest

                    else
                        rest
            in
            result


discard : (a -> Bool) -> List a -> List a
discard predicate list =
    keep (predicate >> not)
        list

Roc

Other Roc solutions.
module [keep, discard]

keep : List a, (a -> Bool) -> List a
keep = \list, predicate ->
    when list is
        [] -> list
        [head, .. as rest] ->
            if predicate head then
                keep rest predicate
                |>
                List.prepend head
            else
                keep rest predicate

discard : List a, (a -> Bool) -> List a
discard = \list, predicate ->
    keep list \elem -> !(predicate elem)