MarioAriasC / funKTionale

Functional constructs for Kotlin
915 stars 71 forks source link

Would you share the script to generate functions with multiple generic params? #31

Closed vjames19 closed 7 years ago

vjames19 commented 7 years ago

In your talk you said you have a script to generate functions like this:

infix inline fun <P1, R> P1.pipe(t: (P1) -> R): R = t(this)

infix inline fun <P1, P2, R> P1.pipe2(crossinline t: (P1, P2) -> R): (P2) -> R = { p2 -> t(this, p2) }

infix inline fun <P1, P2, P3, R> P1.pipe3(crossinline t: (P1, P2, P3) -> R): (P2, P3) -> R = { p2, p3 -> t(this, p2, p3) }

Would you mind sharing it?

I want to automate the generation of functions like that.

MarioAriasC commented 7 years ago

https://github.com/MarioAriasC/funKTionale/blob/master/funktionale-experimental/src/main/kotlin/org/funktionale/generators/generate.kt Enjoy

vjames19 commented 7 years ago

Thanks!

On Mon, Jul 3, 2017 at 11:47 AM Mario Arias notifications@github.com wrote:

https://github.com/MarioAriasC/funKTionale/blob/master/funktionale-experimental/src/main/kotlin/org/funktionale/generators/generate.kt Enjoy

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MarioAriasC/funKTionale/issues/31#issuecomment-312692031, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFijZdt8bfJcUcBSeYzV1LI9pMRBxigks5sKRsMgaJpZM4OMgCH .