14
Kotlinの感触 LLのように書ける(?)
Ruby
[1,2,3].reduce(:+) # => 6
[1,3,5].map{ |a| a+1 } # => [2, 4, 6]
[1, 2, 3, 4, 5, 6, 7, 8].select {|item|
item % 2 == 0 } # => [2, 4, 6, 8]
Kotlin
listOf(1, 2, 3).reduce{ acc, i -> acc + i }
//=> 6
listOf(1,3,5).map{ it+1 } // => [2, 4, 6]
listOf(1, 2, 3, 4, 5, 6, 7, 8).filter {item
-> item % 2 == 0 } // => [2, 4, 6, 8]