Re:Go is my hammer, and everything is a nail
by didntcheck on Tuesday August 13, 2024 @11:51AM
(#41236618)
And I think Kotlin would just be
Though I'm not sure I'm a fan of it eagerly finishing with a List. If you chained several operations you could accidentally be wasting a load of allocations (with the solution being to start with foo.asSequence() instead)
[ Parent
| on HN ]
Re:Go is my hammer, and everything is a nail
by neonsunset on Tuesday August 13, 2024 @12:11PM
(#41236801)
Of course. This was just to illustrate the point, whether to snapshot/collect a projected sequence or not is another matter entirely. It just goes to show that idiomatic and fast* iterator expressions is something that modern general-purpose PLs are ought to have.
* I know little about performance characteristics of Kotlin but assume it is subject to behaviors similar to Java as run by OpenJDK/GraalVM. Perhaps similar caveats as with F#?
Re:Go is my hammer, and everything is a nail
by maccard on Tuesday August 13, 2024 @01:03PM
(#41237222)
Unfortunately Kotlin fails very, very hard on the "iteration speed" side of things. The compilation speed is so unbelieveably slow, and it suffers very very much from the "JVM Startup time" problem.
If it were an order of magnitude faster to compile I'd consider it.