I had a quick scan of the Kotlin repo, and I think it depends on the type that you start out with. The sequence stuff is lazy; the map stuff is eager.
ints.asSequence().filter { it > 0 }.map { it * it }
and then you can convert it to a concrete collection type with toList, toHashSet, toArrayList etc.Why would they advertise chaining together sequence operations like this as being LINQ-like (or like Clojure and other functional languages) when it's eager by default? What is gained by making these eager by default?
It just seems like a poor choice to me. That's a shame, because I feel like it's otherwise a pretty well-designed language.
The reason Kotlin sequence operations aren't lazy by default is probably because Java collections aren't, and Kotlin code is going to spend a lot of time dealing with Java collections. And, frankly, it's always a tradeoff to implement lazy collections in a strict language -- people using them need to become intimately aware of exactly which operations are lazy and which are eager.