annotate tests/list.ur @ 1366:1595a738e4e9

JavaScript compilation of time comparison; fix lexing of XML that includes open parens
author Adam Chlipala <adam@chlipala.net>
date Fri, 24 Dec 2010 18:55:13 -0500
parents 9021d44ba6b2
children
rev   line source
adamc@757 1 fun isNil (t ::: Type) (ls : list t) =
adamc@757 2 case ls of
adamc@762 3 [] => True
adamc@757 4 | _ => False
adamc@196 5
adamc@757 6 fun delist (ls : list string) : xbody =
adamc@757 7 case ls of
adamc@762 8 [] => <xml>Nil</xml>
adamc@762 9 | h :: t => <xml>{[h]} :: {delist t}</xml>
adamc@196 10
adamc@758 11 fun callback ls = return <xml><body>
adamc@758 12 {delist ls}
adamc@758 13 </body></xml>
adamc@758 14
adamc@757 15 fun main () = return <xml><body>
adamc@762 16 {[isNil ([] : list bool)]},
adamc@762 17 {[isNil (1 :: [])]},
adamc@762 18 {[isNil ("A" :: "B" :: [])]}
adamc@196 19
adamc@762 20 <p>{delist ("X" :: "Y" :: "Z" :: [])}</p>
adamc@762 21 <a link={callback ("A" :: "B" :: [])}>Go!</a>
adamc@757 22 </body></xml>