Mercurial > urweb
comparison tests/list.ur @ 758:8323c1beef2e
Subforms type-checks; lists urlified and unurlified
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 30 Apr 2009 11:48:56 -0400 |
parents | fa2019a63ea4 |
children | 9021d44ba6b2 |
comparison
equal
deleted
inserted
replaced
757:fa2019a63ea4 | 758:8323c1beef2e |
---|---|
6 fun delist (ls : list string) : xbody = | 6 fun delist (ls : list string) : xbody = |
7 case ls of | 7 case ls of |
8 Nil => <xml>Nil</xml> | 8 Nil => <xml>Nil</xml> |
9 | Cons (h, t) => <xml>{[h]} :: {delist t}</xml> | 9 | Cons (h, t) => <xml>{[h]} :: {delist t}</xml> |
10 | 10 |
11 fun callback ls = return <xml><body> | |
12 {delist ls} | |
13 </body></xml> | |
14 | |
11 fun main () = return <xml><body> | 15 fun main () = return <xml><body> |
12 {[isNil (Nil : list bool)]}, | 16 {[isNil (Nil : list bool)]}, |
13 {[isNil (Cons (1, Nil))]}, | 17 {[isNil (Cons (1, Nil))]}, |
14 {[isNil (Cons ("A", Cons ("B", Nil)))]} | 18 {[isNil (Cons ("A", Cons ("B", Nil)))]} |
15 | 19 |
16 <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p> | 20 <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p> |
21 <a link={callback (Cons ("A", Cons ("B", Nil)))}>Go!</a> | |
17 </body></xml> | 22 </body></xml> |