> The implementation isn't even that horrible
You're making me blush!
The list of integers could be replaced by using tuples and reading their lengths to do basic arithmetic. Might run into recursion limits though.
You're making me blush!
The list of integers could be replaced by using tuples and reading their lengths to do basic arithmetic. Might run into recursion limits though.
Is that anything like church encoding?
https://www.wikiwand.com/en/Church_encoding#/Church_numerals
type two = [0, 0]
type three = [0, 0, 0]
type five = [...two, ...three]
type TupleToNumber<T extends any[]> = T[“length”]
const num: TupleToNumber<five> = 5