Re:Kotlin 1.1: What’s coming in the standard library
by agumonkey on Wednesday January 25, 2017 @02:20AM
(#13479430)
May I describe it as an effectful identity ?
[ Parent
| on HN ]
Re:Kotlin 1.1: What’s coming in the standard library
by jorgemf on Wednesday January 25, 2017 @04:53AM
(#13480096)
It is not an identity because you can modify the internal state of the objects. And it is also lazy:
arrayOf("A","B","C").onEach{ print("onEach $it")}.forEach{ print("forEach $it")}
prints:
onEach A forEach A onEach B forEach B onEach C forEach C