https://kotlinlang.org logo
#announcements
Title
# announcements
d

dierre

11/28/2017, 3:42 PM
hello, just out of curiosity, do you know if there is an equivalent of for-comprehension in kotlin? Basically something to use instead of
c1.flatMap(x => c2.flatMap(y => c3.map(z => {...})))
which in scala would be
for(x <- c1; y <- c2; z <- c3) yield {...}
m

misko

11/29/2017, 10:57 AM
It is possible to implement something similar with the help of coroutines, but not as general as in Scala. See this for reference http://kategory.io/docs/patterns/monad_comprehensions/
2 Views