changeset 605:1a9171e31fd1

dlist2 working swimmingly
author Adam Chlipala <adamc@hcoop.net>
date Sat, 17 Jan 2009 09:55:12 -0500 (2009-01-17)
parents 20c083327364
children 5145181b02fa
files tests/dlist2.ur tests/dlist2.urp
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/dlist2.ur	Sat Jan 17 09:55:12 2009 -0500
@@ -0,0 +1,25 @@
+datatype dlist = Nil | Cons of string * source dlist
+
+fun delist dl =
+    case dl of
+        Nil => <xml>[]</xml>
+      | Cons (x, s) => <xml>{[x]} <ctextbox/> :: {delistSource s}</xml>
+
+and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml>
+
+fun main () : transaction page =
+    tail0 <- source Nil;
+    tail <- source tail0;
+    tb <- source "";
+    return <xml><body>
+      {delist (Cons ("ROOT", tail0))}
+      <br/>
+      <ctextbox source={tb}/>
+      <button value="Add" onclick={hd <- get tb;
+                                   tl <- source Nil;
+                                   old <- get tail;
+
+                                   set old (Cons (hd, tl));
+                                   set tail tl}/>
+      <button value="Reset" onclick={set tail0 Nil; set tail tail0}/>
+    </body></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/dlist2.urp	Sat Jan 17 09:55:12 2009 -0500
@@ -0,0 +1,3 @@
+debug
+
+dlist2