Hacker News new | ask | show | jobs
by edgyswingset 3887 days ago
(disclaimer: I think Kotlin is cool)

And non-lazy map/reduce/filter. Which I almost see as a deal-breaker.

2 comments

Kotlin does have lazy map/reduce/filter: those are available through the Sequence interface.
It's very limited. Many of the functions you use when operating with collections also return lists, not sequences.
Sequence has much the same extensions available on it as other collections.

I did a tutorial a week or so ago (it's not online yet, unfortunately) on FP in Kotlin. We wrote a little app to do IntelliSense style autocompletion on an n-gram model. The core code was purely functional and used lazyness as well.

I suspect "does Kotlin support FP" is one of those questions that's doomed to turn into a no-true-scotsman thing: whatever support is available will be considered insufficient by true FP fans :-) But it's good enough to let you write code in a typical functional style in many cases, with little cost.

It's not that hard to implement your own stream abstraction.