Addition of a compact_map/2 function to the Enum module

Using List.wrap is just because you want the code even shorter. IMO keeping the original: map + reject is much clearer when read. Shorter is not always more readable.

Shame we don’t have Rust’s filter_map though, it would solve your problem right away.

1 Like