My understanding is that, in functional languages that use pattern matching,
the different functions with the same name get merged together into one
function by the compiler, with a switch/case expression to distinguish between
the different cases.
So Haskell's
factorial :: (Integral a) => a -> a
factorial 0 = 1
factorial n = n * factorial (n - 1)
Run
theoretically compiles into something very much like Nim's
proc fac(n: int): int =
if n == 0: 1
else: n * fac(n - 1)
Run
As others have already said, it's _runtime_ polymorphism, as opposed to the
_compile-time_ polymorphism of Nim's (or C++s, etc.) function overloading. But
you can do the same in Nim, it's just a syntactic difference.