import io.github.runction.*
val plusTwo = { x: Int -> x + 2 }
val plusTen = { x: Int -> x + 10 }
/ /plusTwelve = { x -> plusTen( plusTwo( x ) ) }
val plusTwelve = plusTwo composite plusTen
// { x -> println( plusTwelve( x ) ) }.invoke( 6 )
plusTwelve composite ::println bind 6
//output: 18
val modulo = runc<Int,Runction<Int,Boolean,Boolean,Boolean>,Int,Int> { b ->
runc { a ->
a % b == 0
}
}
val isOdd = modulo(2) compositeOn { not() }
0..9 bindOn
{ toList() } bindOn
{ this::filter bind isOdd } bind ::println
//output: [1, 3, 5, 7, 9]
documentation : https://github.com/muqhc/runction/blob/master/README.md
github repo : https://github.com/muqhc/runction
maven central : https://search.maven.org/artifact/io.github.muqhc/runction
명이
2022.01.09"코드 일부분의 아름다움을 희생하는 대신 다른 일부분의 아름다움을 극대화 시켜주는 라이브러리"