comparison tests/nest.ur @ 448:85819353a84f

First Unnest tests working
author Adam Chlipala <adamc@hcoop.net>
date Sat, 01 Nov 2008 15:58:55 -0400
parents
children 07f6576aeb0a
comparison
equal deleted inserted replaced
447:b77863cd0be2 448:85819353a84f
1 fun add x =
2 let
3 fun add' y = x + y
4 in
5 add' 1 + add' 2
6 end
7
8 fun f (x : int) =
9 let
10 fun page () = return <xml><body>
11 <a link={page ()}>{[x]}</a>
12 </body></xml>
13 in
14 page
15 end
16
17 fun f (x : int) =
18 let
19 fun page1 () = return <xml><body>
20 <a link={page2 ()}>{[x]}</a>
21 </body></xml>
22
23 and page2 () =
24 case Some True of
25 Some r => return <xml><body><a link={page1 ()}>{[r]}</a></body></xml>
26 | _ => return <xml>Error</xml>
27 in
28 page1
29 end
30
31 datatype list t = Nil | Cons of t * list t
32
33 fun length (t ::: Type) (ls : list t) =
34 let
35 fun length' ls acc =
36 case ls of
37 Nil => acc
38 | Cons (_, ls') => length' ls' (acc + 1)
39 in
40 length' ls 0
41 end