Objective
Given a type signature of a C function pointer represented as a string, output the (fully) curried version of it, also as a string.
I/O format
It is assumed that:
- There is at least one parameter.
- The return type and the parameter types are titlecased alphabetic identifiers. (That is, those matching the regex
[A-Z][a-z]*) - The input and the output have no whitespaces.
Otherwise flexible.
Examples
Input -> Output
Foo(*)(Foo) -> Foo(*)(Foo)
Foo(*)(Bar) -> Foo(*)(Bar)
Bar(*)(Foo,Bar) -> Bar(*(*)(Foo))(Bar)
Bar(*)(Foo,Bar,Baz) -> Bar(*(*(*)(Foo))(Bar))(Baz)
()exist in output? \$\endgroup\$((Foo)(*)(Foo))\$\endgroup\$a&b|(a|b)&c... \$\endgroup\$