Changeset [0dcc09f518d1117c73122ed5b0466a3d4fc159bb] by Douglas Creager
March 2nd, 2009 @ 07:33 PM
Dotted values in patterns
Dotted values can occur in a pattern, such as in the parameters to a named function:
f(a.b) = a + b
Based on some experimentation, it turns out that the left-hand side of a dotted pattern must match the first element of a dotted value. The right-hand side must match the “rest” of the dotted value. If the dotted value only contains two elements, then that means it must match the second element. If it contains more than two elements, then that means it must match a slightly smaller dotted value:
a.b matches 1.2 (a == 1, b == 2) a.b matches 1.2.3 (a == 1, b == 2.3) a.b.c matches 1.2.3 (a == 1, b == 2, c = 3) 1.b matches 1.2.3 (b == 2.3) a.3 DOES NOT MATCH 1.2.3 (a == 1, but 3 doesn't match 2.3)
Lighthouse: [#15 state:resolved] http://github.com/hst/hst/commit...
Committed by Douglas Creager
- M cspm/src/HST/CSPM/Parser.hs
- M cspm/src/HST/CSPM/Parser.ly
- M cspm/src/HST/CSPM/Patterns.lhs
- M cspm/src/HST/CSPM/Types.hs
- M cspm/tests/expressions/test-dots.sh
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
An open-source refinement checker for the CSP process algebra.