add curry

This commit is contained in:
tursom 2021-10-14 09:58:52 +08:00
parent 03b83bbe17
commit dc9f8e440f
3 changed files with 720 additions and 3682 deletions

File diff suppressed because it is too large Load Diff

View File

@ -68,11 +68,9 @@ class CurryBuilder {
append(" }\n")
append("}) {\n")
if (index > 2) (1..index - 2).forEach { overrideInvoke ->
append(
" override operator fun invoke(${argsWithType(overrideInvoke)}): Curry${index - overrideInvoke}<${
append(" override operator fun invoke(${argsWithType(overrideInvoke)}): Curry${index - overrideInvoke}<${
types(overrideInvoke + 1, index)
}, R> = Curry${index - overrideInvoke} { ${args(overrideInvoke + 1, index)} ->\n"
)
}, R> = Curry${index - overrideInvoke} { ${args(overrideInvoke + 1, index)} ->\n")
append(" $invokeAction\n")
append(" }\n")
append("\n")
@ -126,10 +124,8 @@ class CurryBuilder {
println("operator fun <$types, R> (($types) -> R).invoke() = curry(this)")
(1 until index).forEach { argCount ->
println(
"operator fun <$types, R> (($types) -> R).invoke(${argsWithType(argCount)}) = " +
"curry(this)(${args(argCount)})"
)
println("operator fun <$types, R> (($types) -> R).invoke(${argsWithType(argCount)}) = " +
"curry(this)(${args(argCount)})")
}
println()
}