3 ms·
foo = [bar(x) for x in quux] This is effectively a map, so it's strange to call it "using monads". "Using functors" would be more accurate. You can get "mona
by dllthomas 12y ago
foo = [bar(x) for x in quux]
This is effectively a map, so it's strange to call it "using monads". "Using functors" would be more accurate.
You can get "monad" out of list comprehensions though, when you have multiple "for" clauses.
foo = [y for x in quux for y in bar(x)]
seems equivalent to foo = quux >>= bar