Mercurial > urweb
comparison tests/nest.ur @ 450:07f6576aeb0a
Wrapping works in Blog
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 01 Nov 2008 16:46:16 -0400 |
parents | 85819353a84f |
children | 787d4931fb07 |
comparison
equal
deleted
inserted
replaced
449:89f766f19d5b | 450:07f6576aeb0a |
---|---|
23 and page2 () = | 23 and page2 () = |
24 case Some True of | 24 case Some True of |
25 Some r => return <xml><body><a link={page1 ()}>{[r]}</a></body></xml> | 25 Some r => return <xml><body><a link={page1 ()}>{[r]}</a></body></xml> |
26 | _ => return <xml>Error</xml> | 26 | _ => return <xml>Error</xml> |
27 in | 27 in |
28 page1 | 28 page2 |
29 end | |
30 | |
31 fun f (x : int) = | |
32 let | |
33 fun page1 () = return <xml><body> | |
34 <a link={page2 ()}>{[x]}</a> | |
35 </body></xml> | |
36 | |
37 and page2 () = | |
38 case Some True of | |
39 Some r => return <xml><body><a link={page1 ()}>{[r]}</a></body></xml> | |
40 | _ => return <xml><body><a link={page3 ()}>!!</a></body></xml> | |
41 | |
42 and page3 () = return <xml><body><a link={page2 ()}>!</a><a link={page1 ()}>!</a> | |
43 <a link={page3 ()}>!</a></body></xml> | |
44 in | |
45 page3 | |
29 end | 46 end |
30 | 47 |
31 datatype list t = Nil | Cons of t * list t | 48 datatype list t = Nil | Cons of t * list t |
32 | 49 |
33 fun length (t ::: Type) (ls : list t) = | 50 fun length (t ::: Type) (ls : list t) = |
37 Nil => acc | 54 Nil => acc |
38 | Cons (_, ls') => length' ls' (acc + 1) | 55 | Cons (_, ls') => length' ls' (acc + 1) |
39 in | 56 in |
40 length' ls 0 | 57 length' ls 0 |
41 end | 58 end |
59 |