comparison tests/case.ur @ 244:71bafe66dbe1

Laconic -> Ur
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 08:32:18 -0400
parents tests/case.lac@c7a6e6dbc318
children
comparison
equal deleted inserted replaced
243:2b9dfaffb008 244:71bafe66dbe1
1 datatype t = A | B
2
3 val swap = fn x : t => case x of A => B | B => A
4
5 datatype u = C of t | D
6
7 val out = fn x : u => case x of C y => y | D => A
8
9 datatype nat = O | S of nat
10
11 val is_two = fn x : nat =>
12 case x of S (S O) => A | _ => B
13
14 val zero_is_two = is_two O
15 val one_is_two = is_two (S O)
16 val two_is_two = is_two (S (S O))