Mercurial > urweb
annotate 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 |
rev | line source |
---|---|
adamc@170 | 1 datatype t = A | B |
adamc@170 | 2 |
adamc@170 | 3 val swap = fn x : t => case x of A => B | B => A |
adamc@170 | 4 |
adamc@170 | 5 datatype u = C of t | D |
adamc@170 | 6 |
adamc@170 | 7 val out = fn x : u => case x of C y => y | D => A |
adamc@170 | 8 |
adamc@170 | 9 datatype nat = O | S of nat |
adamc@170 | 10 |
adamc@170 | 11 val is_two = fn x : int_list => |
adamc@170 | 12 case x of S (S O) => A | _ => B |