Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.


A.1.6 Tuples

Syntax

(1,2), (4,<>,{7}) pair and triple

Remarks

Function application also uses parentheses, so functions which take a tuple as their argument need two sets of parentheses. For example the function which adds together the elements of a pair can be written either as

plus((x,y)) = x+y

or as

plus(p) = let (x,y) = p within x + y

The same notation is used in type definitions to denote the corresponding product type. For example, if we have

nametype T = ({0..2},{1,3})

then T is

{ (0,1), (0,3), (1,1), (1,3), (2,1), (2,3) }


Go to the Next or Previous section, the Detailed Contents, or the FS(E)L Home Page.