3 ms·
Kotlin does have lazy map/reduce/filter: those are available through the Sequence interface.
by yole 11y ago
Kotlin does have lazy map/reduce/filter: those are available through the Sequence interface.
- edgyswingset 11y agoIt's very limited. Many of the functions you use when operating with collections also return lists, not sequences.
- mike_hearn 11y agoSequence 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.