Mercurial > urweb
comparison tests/case.lac @ 171:c7a6e6dbc318
Elaborating some basic pattern matching
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 31 Jul 2008 10:06:27 -0400 |
parents | a158f8c5aa55 |
children |
comparison
equal
deleted
inserted
replaced
170:a158f8c5aa55 | 171:c7a6e6dbc318 |
---|---|
6 | 6 |
7 val out = fn x : u => case x of C y => y | D => A | 7 val out = fn x : u => case x of C y => y | D => A |
8 | 8 |
9 datatype nat = O | S of nat | 9 datatype nat = O | S of nat |
10 | 10 |
11 val is_two = fn x : int_list => | 11 val is_two = fn x : nat => |
12 case x of S (S O) => A | _ => B | 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)) |