(no subject)

Date: 2009-11-04 02:50 am (UTC)
jducoeur: (0)
From: [personal profile] jducoeur
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.)
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

jducoeur: (Default)
jducoeur

July 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27 28293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags