Or-patterns

George Russell ger@Informatik.Uni-Bremen.DE
Mon, 04 Dec 2000 17:17:42 +0100


Why not steal a good idea from Standard ML/New Jersey now and again?  This has
"Or-patterns" which allow you to match against a disjunction of patterns,
EG

fun sleepIn (Date.Sat | Date.Sun) = true
|   sleepIn _ = false

Where you have variables in the patterns, you bind only the variables which appear 
in all the patterns, and you unify the types accordingly.

Of course you can do without this feature, but I feel it shouldn't be too hard
to implement and for me at least it would be occasionally useful.