filter in Rust works on predicates (booleans), while filter_map works on option types, which is different to Elixir’s previous filter_map.
My experience with compact in Ruby does not make me optimistic for making it part of the language. A lot of times it was added to remove nils from collection when the better question was to ask why nil is being part of the list in the first place. |> Enum.reject(&is_nil/1) is clear enough without introducing a new verb (compact) for everyone to learn.
I don’t rule out adding functions such as filter_ok and find_ok though, that explicitly look for ok tuples, but then we need to decide if we discard everything else or if we discard specific error results.
Thanks for starting this discussion!






















