view tests/list.ur @ 759:67cd8326f743

subforms working
author Adam Chlipala <adamc@hcoop.net>
date Thu, 30 Apr 2009 13:47:46 -0400
parents 8323c1beef2e
children 9021d44ba6b2
line wrap: on
line source
fun isNil (t ::: Type) (ls : list t) =
    case ls of
        Nil => True
      | _ => False

fun delist (ls : list string) : xbody =
        case ls of
            Nil => <xml>Nil</xml>
          | Cons (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)))]}

  <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p>
  <a link={callback (Cons ("A", Cons ("B", Nil)))}>Go!</a>
</body></xml>