blob: 6dde36014e867e06d009ddb523ed1c7c0e1c2918 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
enum Foo(Zero, One(x:Int), Two(x,y:Int))
>> Foo.Zero()
= Foo.Zero()
>> Foo.One(123)
= Foo.One(x=123)
>> Foo.Two(123, 456)
= Foo.Two(x=123, y=456)
>> Foo.One(10) == Foo.One(10)
= yes
>> Foo.One(10) == Foo.Zero()
= no
>> Foo.One(10) == Foo.One(-1)
= no
>> Foo.One(10) < Foo.Two(1, 2)
= yes
>> x := Foo.One(123)
>> t := {x=>"found"; default="missing"}
>> t[x]
= "found"
>> t[Foo.Zero()]
= "missing"
when x is o:One
>> o.x
= 123
else
fail("Oops")
|