@Gankro I love thinking of `Option` as a container with a maximum count of 1
-
-
Replying to @JakeGoulding
"take a list of lists and concat the sublists into one" "keep doing some fallible op until one step fails" SO DIFFERENT
4 replies 0 retweets 0 likes -
Replying to @Gankra_
ITYM take a list of things, transform each thing into a list; and combine the results into one. You forgot the map part of flat_map
1 reply 0 retweets 0 likes -
Replying to @JakeGoulding
character limit -- I haven't generally seen "lossy" flat_maps. I think all I've seen are ones that "strictly grow". Disagree?
2 replies 0 retweets 0 likes -
Replying to @Gankra_
main example I think of immediately is Iterator<Option<T>> -> Vec<T> via flat_map (or Result).
1 reply 0 retweets 0 likes -
Replying to @JakeGoulding
ah, so basically just "filter, but our type system is too good to admit it"
1 reply 0 retweets 0 likes -
Replying to @Gankra_ @JakeGoulding
oh no wait, our type system isn't https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.filter_map …
3 replies 0 retweets 0 likes -
Replying to @Gankra_ @JakeGoulding
flat_map is like fold -- it's a complete friggin' mess because it's some super generic thing that obfuscates everything!
2 replies 0 retweets 0 likes
(shrug) I see it as a way of adapting 1 element to 0, 1, or N elements. For an iterator, the adapter is called many times.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.