From b12608fb0947122fe65d9736eabf59266ad08252 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 17 May 2005 11:37:17 +0000 Subject: ml and tl --- doc/tutorial/gf-tutorial2.html | 47 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'doc/tutorial/gf-tutorial2.html') diff --git a/doc/tutorial/gf-tutorial2.html b/doc/tutorial/gf-tutorial2.html index edf7d66c5..ba96d2cae 100644 --- a/doc/tutorial/gf-tutorial2.html +++ b/doc/tutorial/gf-tutorial2.html @@ -21,7 +21,7 @@

-12 May 2005 +17 May 2005 @@ -634,9 +634,9 @@ makes this in a subshell of GF. You can also generate a list of translation exercises and save it in a file for later use, by the command translation_list = tl

-  > translation_list PaleolithicEng PaleolithicIta 25
+  > translation_list -number=25 PaleolithicEng PaleolithicIta
 
-(The number 25 is the number of sentences generated.) +The number flag gives the number of sentences generated. @@ -1125,6 +1125,47 @@ lin + +

Hierarchic parameter types

+ +The reader familiar with a functional programming language such as +Haskell must have noticed the similarity +between parameter types in GF and algebraic datatypes (data definitions +in Haskell). The GF parameter types are actually a special case of algebraic +datatypes: the main restriction is that in GF, these types must be finite. +(This restriction makes it possible to invert linearization rules into +parsing methods.) + +

+ +However, finite is not the same thing as enumerated. Even in GF, parameter +constructors can take arguments, provided these arguments are from other +parameter types (recursion is forbidden). Such parameter types impose a +hierarchic order among parameters. They are often useful to define +linguistically accurate parameter systems. + +

+ +To give an example, Swedish adjectives +are inflected in number (singular or plural) and +gender (uter or neuter). These parameters would suggest 2*2=4 different +forms. However, the gender distinction is done only in the singular. Therefore, +it would be inaccurate to define adjective paradigms using the type +Gender => Number => Str. The following hierarchic definition +yields an accurate system of three adjectival forms. +

+  param AdjForm = ASg Gender | APl ;
+  param Gender  = Uter | Neuter ;
+
+In pattern matching, a constructor can have patterns as arguments. For instance, +the adjectival paradigm in which the two singular forms are the same, can be defined +
+  oper plattAdj : Str -> AdjForm => Str = \x -> table {
+    ASg _ => x ;
+    APl   => x + "a" ;
+    }
+
+

Topics still to be written

-- cgit v1.2.3