Mercurial > urweb
comparison tests/nest.ur @ 453:787d4931fb07
Almost have that nested save function compiling
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 01 Nov 2008 21:19:43 -0400 |
parents | 07f6576aeb0a |
children |
comparison
equal
deleted
inserted
replaced
452:222cbc1da232 | 453:787d4931fb07 |
---|---|
43 <a link={page3 ()}>!</a></body></xml> | 43 <a link={page3 ()}>!</a></body></xml> |
44 in | 44 in |
45 page3 | 45 page3 |
46 end | 46 end |
47 | 47 |
48 datatype list t = Nil | Cons of t * list t | 48 fun add2 (x : int) (y : int) = |
49 let | |
50 fun add3 () = x + y | |
51 in | |
52 add3 | |
53 end | |
54 | |
55 fun add3 (x : int) = | |
56 let | |
57 fun add2 (y : int) = | |
58 let | |
59 fun add1 (z : int) = x + y + z | |
60 in | |
61 add1 | |
62 end | |
63 in | |
64 add2 | |
65 end | |
66 | |
67 (*datatype list t = Nil | Cons of t * list t | |
49 | 68 |
50 fun length (t ::: Type) (ls : list t) = | 69 fun length (t ::: Type) (ls : list t) = |
51 let | 70 let |
52 fun length' ls acc = | 71 fun length' ls acc = |
53 case ls of | 72 case ls of |
55 | Cons (_, ls') => length' ls' (acc + 1) | 74 | Cons (_, ls') => length' ls' (acc + 1) |
56 in | 75 in |
57 length' ls 0 | 76 length' ls 0 |
58 end | 77 end |
59 | 78 |
79 *) |