A cute example of patten matching with algebraic data types, in various languages: http://www.rosettacode.org/wiki/Pattern_Matching Bye, bearophile