Zulip Chat Archive

Stream: general

Topic: idiom


Scott Morrison (Apr 16 2018 at 09:05):

Is there an idiomatic way to flatten a list (option A) to a list A?

Mario Carneiro (Apr 16 2018 at 09:06):

join (to_list o l)

Scott Morrison (Apr 16 2018 at 09:06):

okay

Scott Morrison (Apr 16 2018 at 09:07):

err.. what? What are your o and l?

Mario Carneiro (Apr 16 2018 at 09:07):

oh, that was composition but it should be map

Mario Carneiro (Apr 16 2018 at 09:07):

or you can use bind

Mario Carneiro (Apr 16 2018 at 09:08):

l.bind option.to_list should work

Scott Morrison (Apr 16 2018 at 09:09):

perfect, thanks


Last updated: Dec 20 2023 at 11:08 UTC