adamc@315: datatype list a = Nil | Cons of a * list a adamc@315: adamc@315: fun isNil (t ::: Type) (ls : list t) : bool = adamc@315: case ls of adamc@315: Nil => True adamc@315: | Cons _ => False adamc@315: adamc@316: fun append (t ::: Type) (ls1 : list t) (ls2 : list t) : list t = adamc@315: case ls1 of adamc@315: Nil => ls2 adamc@315: | Cons (x, ls1') => Cons (x, append ls1' ls2) adamc@315: adamc@315: fun delist (ls : list string) : xml body [] [] = adamc@315: case ls of adamc@315: Nil =>
Nil adamc@316: | Cons (h, t) => {cdata h} :: {delist t} adamc@315: adamc@315: val ls = Cons ("X", Cons ("Y", Cons ("Z", Nil))) adamc@316: val ls' = Cons ("A", Cons ("B", Nil)) adamc@315: adamc@315: fun main () : transaction page = return adamc@315: {if isNil ls then It's Nil. else It's not Nil.} adamc@316: adamc@316:{delist (append ls' ls)}
adamc@315: adamc@315: adamc@315: adamc@315: adamc@316: