Adding different types of number using multiple dispatch
Adding different types of number using multiple dispatch
This is part of a series on solving Paul Graham’s accumulator problem in Swift. You can find Part 1 here.
In the previous post, we solved the requirement that our accumulator accept any kind of numeric type, and to “upgrade” the type it returns from an integer to floating point only the first time it is called with a floating point number, using the Swift Any type:
func foo(var n: Any) -> (Any)…
View On WordPress















