Generic programming

From Rosetta Code