<@U84KF4UHM> Plain Kotlin: ``` val result: List&l...
# codereview
r
@ecampolo Plain Kotlin:
Copy code
val result: List<FooBar> = 
    foos.flatMap { foo ->
        foo.bars.map { bar ->
            FooBar(foo, bar)
        }
    }
With support for
comprehensions
with Kategory in a generator style:
Copy code
val resultK: ListKW<FooBar> = 
   ListKW.monad().binding {
        val foo = foos.k().bind()
        val bar = foo.bars.k().bind()
        yields(FooBar(foo, bar))
   }.ev()
There may be another way to as well with
buildSequence
or similar.