Is there a direct Julia equivalent of Rust's `retain()` method?

Is there a direct Julia equivalent of Rust’s retain() method?

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

Yes. Iterators.filter (as already answered on Slack)

1 Like

Other similar options as suggested by Jerry Ling and Karl Dyrhage:
filter!(x -> foo(x, a, b), [...]) incase foo takes more than one arguments.

or

filter!([...]) do element
    foo(element, a, b)
end