adamc@605: datatype dlist = Nil | Cons of string * source dlist
adamc@605: 
adamc@605: fun delist dl =
adamc@605:     case dl of
adamc@605:         Nil => <xml>[]</xml>
adamc@605:       | Cons (x, s) => <xml>{[x]} <ctextbox/> :: {delistSource s}</xml>
adamc@605: 
adamc@605: and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml>
adamc@605: 
adamc@605: fun main () : transaction page =
adamc@605:     tail0 <- source Nil;
adamc@605:     tail <- source tail0;
adamc@605:     tb <- source "";
adamc@605:     return <xml><body>
adamc@605:       {delist (Cons ("ROOT", tail0))}
adamc@605:       <br/>
adamc@605:       <ctextbox source={tb}/>
adamc@605:       <button value="Add" onclick={hd <- get tb;
adamc@605:                                    tl <- source Nil;
adamc@605:                                    old <- get tail;
adamc@605: 
adamc@605:                                    set old (Cons (hd, tl));
adamc@605:                                    set tail tl}/>
adamc@605:       <button value="Reset" onclick={set tail0 Nil; set tail tail0}/>
adamc@605:     </body></xml>