Created simple functional pattern matching construct.

Please consider this contribution.