summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2005-12-20 22:38:38 +0000
committeraarne <aarne@cs.chalmers.se>2005-12-20 22:38:38 +0000
commit59ee1bfd7c430576427943384f2e52efb9b3da08 (patch)
tree7b737c9be67f41504649c376ab743987f2012d60 /doc
parent7383e6d93ed111b418a27bb8605973fa77f3135c (diff)
full disjunctive patterns ; more prec levels for Exp
Diffstat (limited to 'doc')
-rw-r--r--doc/tutorial/gf-tutorial2.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/tutorial/gf-tutorial2.txt b/doc/tutorial/gf-tutorial2.txt
index 0d530c22a..9ba3a9619 100644
--- a/doc/tutorial/gf-tutorial2.txt
+++ b/doc/tutorial/gf-tutorial2.txt
@@ -1704,6 +1704,36 @@ Product types and tuples are syntactic sugar for record types and records:
Thus the labels ``p1, p2,...``` are hard-coded.
+===Record and tuple patterns===
+
+Record types of parameter types are also parameter types.
+A typical example is a record of agreement features, e.g. French
+```
+ oper Agr : PType = {g : Gender ; n : Number ; p : Person} ;
+```
+Notice the term ``PType`` rather than just ``Type`` referring to
+parameter types. Every ``PType`` is also a ``Type``.
+
+Pattern matching is done in the expected way, but it can moreover
+utilize partial records: the branch
+```
+ {g = Fem} => t
+```
+in a table of type ``Agr => T`` means the same as
+```
+ {g = Fem ; n = _ ; p = _} => t
+```
+Tuple patterns are translated to record patterns in the
+same way as tuples to records; partial patterns make it
+possible to write, slightly surprisingly,
+```
+ case <g,n,p> of {
+ <Fem> => t
+ ...
+ }
+```
+
+
%--!
===Prefix-dependent choices===