comparison tests/dlist2.ur @ 605:1a9171e31fd1

dlist2 working swimmingly
author Adam Chlipala <adamc@hcoop.net>
date Sat, 17 Jan 2009 09:55:12 -0500
parents
children
comparison
equal deleted inserted replaced
604:20c083327364 605:1a9171e31fd1
1 datatype dlist = Nil | Cons of string * source dlist
2
3 fun delist dl =
4 case dl of
5 Nil => <xml>[]</xml>
6 | Cons (x, s) => <xml>{[x]} <ctextbox/> :: {delistSource s}</xml>
7
8 and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml>
9
10 fun main () : transaction page =
11 tail0 <- source Nil;
12 tail <- source tail0;
13 tb <- source "";
14 return <xml><body>
15 {delist (Cons ("ROOT", tail0))}
16 <br/>
17 <ctextbox source={tb}/>
18 <button value="Add" onclick={hd <- get tb;
19 tl <- source Nil;
20 old <- get tail;
21
22 set old (Cons (hd, tl));
23 set tail tl}/>
24 <button value="Reset" onclick={set tail0 Nil; set tail tail0}/>
25 </body></xml>