Hacker News new | ask | show | jobs
by yole 3883 days ago
Kotlin does have lazy map/reduce/filter: those are available through the Sequence interface.
1 comments

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.