aboutsummaryrefslogtreecommitdiffhomepage
path: root/demo/more/grid.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-17 16:35:11 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-17 16:35:11 -0400
commitae83d3e44959b43c167ba83736055bf94ace3113 (patch)
tree9d7a2e3bc1dff89e7399d555415ffae5c45c8b52 /demo/more/grid.ur
parentbf1a78ce9a5d60f8f4c40d0087f6caf90c10a796 (diff)
Basic tail recursion introduction seems to be working
Diffstat (limited to 'demo/more/grid.ur')
-rw-r--r--demo/more/grid.ur17
1 files changed, 11 insertions, 6 deletions
diff --git a/demo/more/grid.ur b/demo/more/grid.ur
index 2b451456..a4157991 100644
--- a/demo/more/grid.ur
+++ b/demo/more/grid.ur
@@ -59,16 +59,20 @@ functor Make(M : sig
Selection : source bool,
Filters : $(map thd3 M.cols)}
- fun addRow cols rows row =
+ fun newRow cols row =
rowS <- source row;
cols <- makeAll cols row;
colsS <- source cols;
ud <- source False;
sd <- source False;
- Monad.ignore (Dlist.append rows {Row = rowS,
- Cols = colsS,
- Updating = ud,
- Selected = sd})
+ return {Row = rowS,
+ Cols = colsS,
+ Updating = ud,
+ Selected = sd}
+
+ fun addRow cols rows row =
+ r <- newRow cols row;
+ Monad.ignore (Dlist.append rows r)
val grid =
cols <- Monad.mapR [colMeta M.row] [fst3]
@@ -91,7 +95,8 @@ functor Make(M : sig
fun sync {Cols = cols, Rows = rows, ...} =
Dlist.clear rows;
init <- rpc M.list;
- List.app (addRow cols rows) init
+ rs <- List.mapM (newRow cols) init;
+ Dlist.replace rows rs
fun render grid = <xml>
<table class={tabl}>