comparison tests/case.lac @ 170:a158f8c5aa55

Parsing basic patterns
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 16:38:15 -0400
parents
children c7a6e6dbc318
comparison
equal deleted inserted replaced
169:2232ab355f66 170:a158f8c5aa55
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 : int_list =>
12 case x of S (S O) => A | _ => B