comparison tests/dlist.ur @ 601:7c3c21eb5b4c

Initial experiments with nested <dyn>
author Adam Chlipala <adamc@hcoop.net>
date Tue, 13 Jan 2009 15:17:11 -0500
parents
children b1064de2b1f9
comparison
equal deleted inserted replaced
600:d1cce194180d 601:7c3c21eb5b4c
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]} :: {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 ns <- source Nil;
12 s <- source ns;
13 tb <- source "";
14 return <xml><body>
15 <dyn signal={s <- signal s; return (delistSource s)}/><br/>
16 <br/>
17 <ctextbox source={tb}/>
18 <button value="Add" onclick={hd <- get tb;
19 tl <- get s;
20 s' <- source (Cons (hd, tl));
21 set s s'}/>
22 </body></xml>