-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathComparison.gf
More file actions
23 lines (21 loc) · 775 Bytes
/
Comparison.gf
File metadata and controls
23 lines (21 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
resource Comparison = open Prelude in {
oper
-- first we declare types
myrecord : { one : Predef.Int ;
two : Predef.Int ;
three : Predef.Int ;
four : Predef.Int };
mytable : Str => Predef.Int;
myfunc : Str -> Predef.Int;
-- then we define values
myrecord = { one = 1 ; two = 2 ; three = 3 ; four = 4 };
mytable = table { "one" => 1
; "two" => 2
; "three" => 3
; "four" => 4
; _ => 0 };
myfunc s = ifTok Predef.Int s "one" 1 (
ifTok Predef.Int s "two" 2 (
ifTok Predef.Int s "three" 3 (
ifTok Predef.Int s "four" 4 0)));
}