Zulip Chat Archive

Stream: Is there code for X?

Topic: filter nones


Bolton Bailey (Nov 03 2021 at 21:02):

Is there the equivalent of https://hackage.haskell.org/package/base-4.14.1.0/docs/Data-Maybe.html#v:catMaybes, of type list (option α) -> list α which just filters out the nones?

Eric Wieser (Nov 03 2021 at 21:04):

Do we have docs#list.filter_map?

Eric Wieser (Nov 03 2021 at 21:05):

Yes, you want list.filter_map id

Bolton Bailey (Nov 03 2021 at 21:05):

Lol thanks

Floris van Doorn (Nov 03 2021 at 21:06):

docs#list.reduce_option

Bolton Bailey (Nov 03 2021 at 21:06):

Even better


Last updated: Dec 20 2023 at 11:08 UTC