aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/listGroupBy.ur
diff options
context:
space:
mode:
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>