summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-01-13 15:17:11 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-01-13 15:17:11 -0500
commit0d98ce87ef495ab8652327866b9a2253cbe824d7 (patch)
treea43e5082a4a3349616ad6b68329b7e363e1e7926 /tests
parent0d9b4b2f411af95f9a886a3b188f0b2c688be27b (diff)
Initial experiments with nested <dyn>
Diffstat (limited to 'tests')
-rw-r--r--tests/dlist.ur22
-rw-r--r--tests/dlist.urp3
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/dlist.ur b/tests/dlist.ur
new file mode 100644
index 00000000..211291bc
--- /dev/null
+++ b/tests/dlist.ur
@@ -0,0 +1,22 @@
+datatype dlist = Nil | Cons of string * source dlist
+
+fun delist dl =
+ case dl of
+ Nil => <xml>[]</xml>
+ | Cons (x, s) => <xml>{[x]} :: {delistSource s}</xml>
+
+and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml>
+
+fun main () : transaction page =
+ ns <- source Nil;
+ s <- source ns;
+ tb <- source "";
+ return <xml><body>
+ <dyn signal={s <- signal s; return (delistSource s)}/><br/>
+ <br/>
+ <ctextbox source={tb}/>
+ <button value="Add" onclick={hd <- get tb;
+ tl <- get s;
+ s' <- source (Cons (hd, tl));
+ set s s'}/>
+ </body></xml>
diff --git a/tests/dlist.urp b/tests/dlist.urp
new file mode 100644
index 00000000..16037274
--- /dev/null
+++ b/tests/dlist.urp
@@ -0,0 +1,3 @@
+debug
+
+dlist