summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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