Mercurial > urweb
diff tests/list.ur @ 762:9021d44ba6b2
List notations
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 30 Apr 2009 15:10:13 -0400 |
parents | 8323c1beef2e |
children |
line wrap: on
line diff
--- a/tests/list.ur Thu Apr 30 14:48:23 2009 -0400 +++ b/tests/list.ur Thu Apr 30 15:10:13 2009 -0400 @@ -1,22 +1,22 @@ fun isNil (t ::: Type) (ls : list t) = case ls of - Nil => True + [] => True | _ => False fun delist (ls : list string) : xbody = case ls of - Nil => <xml>Nil</xml> - | Cons (h, t) => <xml>{[h]} :: {delist t}</xml> + [] => <xml>Nil</xml> + | h :: t => <xml>{[h]} :: {delist t}</xml> fun callback ls = return <xml><body> {delist ls} </body></xml> fun main () = return <xml><body> - {[isNil (Nil : list bool)]}, - {[isNil (Cons (1, Nil))]}, - {[isNil (Cons ("A", Cons ("B", Nil)))]} + {[isNil ([] : list bool)]}, + {[isNil (1 :: [])]}, + {[isNil ("A" :: "B" :: [])]} - <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p> - <a link={callback (Cons ("A", Cons ("B", Nil)))}>Go!</a> + <p>{delist ("X" :: "Y" :: "Z" :: [])}</p> + <a link={callback ("A" :: "B" :: [])}>Go!</a> </body></xml>