summaryrefslogtreecommitdiff
path: root/tests/listGroupBy.ur
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-31 18:29:03 -0400
committerGravatar Benjamin Barenblat <bbaren@mit.edu>2020-05-31 18:29:03 -0400
commit6cc104634ef64be3be88c1fccbe98208d95d8a1a (patch)
tree9001e5333e808808125978a52669a8bff3639438 /tests/listGroupBy.ur
parent82fde07cef0e41b700b9a30137562eb05f2f2c6d (diff)
parentc2f1e1096f602b1cbd4531352f3e1ea6d656a186 (diff)
Merge branch 'dfsg_clean'
Diffstat (limited to 'tests/listGroupBy.ur')
-rw-r--r--tests/listGroupBy.ur13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/listGroupBy.ur b/tests/listGroupBy.ur
new file mode 100644
index 00000000..c2419ce1
--- /dev/null
+++ b/tests/listGroupBy.ur
@@ -0,0 +1,13 @@
+fun lister () = List.tabulateM (fn _ => n <- rand; return (n % 100)) 8
+
+fun main () : transaction page =
+ inp <- source [];
+ return <xml><body>
+ <button value="Compute" onclick={fn _ =>
+ ls <- rpc (lister ());
+ set inp ls}/>
+
+ <dyn signal={inp <- signal inp; return (txt inp)}/>
+ -&gt;
+ <dyn signal={inp <- signal inp; return (txt (List.groupBy (fn n m => n % 2 = m % 2) inp))}/>
+ </body></xml>