Last active
December 9, 2022 01:03
-
-
Save swankjesse/095ccdcc7a95621f499b3548fc944b6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
println("a" to "b") | |
println("a" to "b" tre "c") | |
println("a" to "b" tre "c" fo "d") | |
println("a" to "b" tre "c" fo "d" fi "e") | |
println("a" to "b" tre "c" fo "d" fi "e" sik "f") | |
println("a" to "b" tre "c" fo "d" fi "e" sik "f" seva "g") | |
} | |
infix fun <A, B, C> Pair<A, B>.tre(c: C) = Triple(first, second, c) | |
infix fun <A, B, C, D> Triple<A, B, C>.fo(d: D) = Quad(first, second, third, d) | |
infix fun <A, B, C, D, E> Quad<A, B, C, D>.fi(e: E) = Jackson(a, b, c, d, e) | |
infix fun <A, B, C, D, E, F> Jackson<A, B, C, D, E>.sik(f: F) = Rainbow(a, b, c, d, e, f) | |
infix fun <A, B, C, D, E, F, G> Rainbow<A, B, C, D, E, F>.seva(g: G) = Lucky(a, b, c, d, e, f, g) | |
data class Quad<out A, out B, out C, out D>( | |
val a: A, | |
val b: B, | |
val c: C, | |
val d: D | |
) | |
data class Jackson<out A, out B, out C, out D, out E>( | |
val a: A, | |
val b: B, | |
val c: C, | |
val d: D, | |
val e: E | |
) | |
data class Rainbow<out A, out B, out C, out D, out E, out F>( | |
val a: A, | |
val b: B, | |
val c: C, | |
val d: D, | |
val e: E, | |
val f: F | |
) | |
data class Lucky<out A, out B, out C, out D, out E, out F, out G>( | |
val a: A, | |
val b: B, | |
val c: C, | |
val d: D, | |
val e: E, | |
val f: F, | |
val g: G | |
) |
Yes officer, this gist right here.
I regret only that I cannot happily react to the above comment by @ZacSweers
Clearly this needs:
data class Crazy<out A, out B, out C, out D, out E, out F, out G, out H>(
val a: A,
val b: B,
val c: C,
val d: D,
val e: E,
val f: F,
val g: G,
val h: H
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about suggestion to Kotlin lang? ;-)