uhe
10/27/2016, 2:03 PMfun composed(val: Int) = (::trice..::twice..::same) (val)
so many dots....hastebrot
10/27/2016, 2:09 PM..
could maybe replaced by infix function then
.hastebrot
10/27/2016, 2:10 PMchain
function:
fun main(args: Array<String>) {
println(chain(::identity, ::successor, ::squared)(2))
}
fun identity(value: Int) = value
fun successor(value: Int) = value + 1
fun squared(value: Int) = value * value
fun <A, B, C, D> chain(f1: (A) -> B,
f2: (B) -> C,
f3: (C) -> D) = { it: A -> f3(f2(f1(it))) }
uhe
10/27/2016, 2:10 PMhastebrot
10/27/2016, 2:12 PMdh44t
10/27/2016, 2:12 PMrangeTo
(..
) with a then semanticdh44t
10/27/2016, 2:13 PMhastebrot
10/27/2016, 2:17 PMcurried
.dh44t
10/27/2016, 2:17 PMnfrankel
10/27/2016, 2:17 PMdh44t
10/27/2016, 2:17 PMandThen
pardom
10/27/2016, 2:21 PMpardom
10/27/2016, 2:21 PMI think we are not ready for adding such operators to the language ATM
dh44t
10/27/2016, 2:22 PMdh44t
10/27/2016, 2:22 PMy2k_
10/27/2016, 2:24 PMdh44t
10/27/2016, 2:27 PMdh44t
10/27/2016, 2:27 PMirus
10/28/2016, 2:11 PMroman.belov
10/28/2016, 2:17 PMroman.belov
10/28/2016, 7:02 PMthomasnield
10/29/2016, 12:58 PMeenriquelopez
10/30/2016, 1:05 PMkirillrakhman
10/30/2016, 1:06 PMnfrankel
10/30/2016, 3:45 PMorangy
orangy
roman.belov
11/01/2016, 5:06 PMroman.belov
11/02/2016, 1:35 PM