Mercurial > urweb
annotate tests/list.ur @ 925:552c989c1601
Change string URLification to avoid using the empty string, which confuses Apache no2slash()
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 12 Sep 2009 09:31:50 -0400 |
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> |