By ksh2dzone
via hcoding.blogspot.com
Submitted: Aug 27 2008 / 16:11
Pattern matching works best with built in facilities in the language, yet this was fun to implement.
Basically a pattern matching statement(expression, computation) is of type Type1 => Type2 which means it get a value of type Type1 and returns a value of type Type2. We need a set of pairs of lambdas. Each pair consists of computations of type (Type1 => bool, Type1 => Type2). First item of this pair helps us to decide if we must execute the second part or not; ...
Add your comment