Zulip Chat Archive

Stream: general

Topic: idiom


view this post on Zulip Scott Morrison (Apr 16 2018 at 09:05):

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

view this post on Zulip Mario Carneiro (Apr 16 2018 at 09:06):

join (to_list o l)

view this post on Zulip Scott Morrison (Apr 16 2018 at 09:06):

okay

view this post on Zulip Scott Morrison (Apr 16 2018 at 09:07):

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

view this post on Zulip Mario Carneiro (Apr 16 2018 at 09:07):

oh, that was composition but it should be map

view this post on Zulip Mario Carneiro (Apr 16 2018 at 09:07):

or you can use bind

view this post on Zulip Mario Carneiro (Apr 16 2018 at 09:08):

l.bind option.to_list should work

view this post on Zulip Scott Morrison (Apr 16 2018 at 09:09):

perfect, thanks


Last updated: May 14 2021 at 13:24 UTC