Actually, it makes sense when you think of it as a functional pattern-matching language. In the pattern they show, I believe "Then" and "Else" are simply syntactic sugar. That is, it's saying that, if you hit a pattern of the form "x Then (e.1) Else (e.2)", and x is T (presumably the atom for "true"), then do e.1. Essentially, it's defining the usual if-then-else syntax on top of simple pattern-matching.
Similarly, the Equality pattern is saying that, if the two parameters evaluate to the same value (note the doubled use of e.1), return T; otherwise (I assume that patterns are evaluated in order), they evaluate to different values, so return F.
It seems like pretty conventional stuff nowadays -- I suspect you could write similar examples in most of the popular modern pattern-matching languages. (I'm not an expert in this area, but it looks a lot like examples I've seen in Scala.)
(no subject)
Date: 2009-11-04 02:50 am (UTC)Similarly, the Equality pattern is saying that, if the two parameters evaluate to the same value (note the doubled use of e.1), return T; otherwise (I assume that patterns are evaluated in order), they evaluate to different values, so return F.
It seems like pretty conventional stuff nowadays -- I suspect you could write similar examples in most of the popular modern pattern-matching languages. (I'm not an expert in this area, but it looks a lot like examples I've seen in Scala.)