<https://kotlinlang.slack.com/archives/general/p14...
# announcements
i
https://kotlinlang.slack.com/archives/general/p1461253890000557 Loop fusion is an interesting optimization, but what concerns me is that it changes the evaluation order, for example:
Copy code
list.filter { predicate(it) }.map { transform(it) }
Here
filter
evaluates predicate for each element, and after that
map
performs a transform on each element passed the predicate. By fusing them into a single loop one changes an order of evaluation — now predicate and transform calls are interleaved:
Copy code
list.forEach { 
    if (predicate(it)) 
        result.add(transform(it))
}