summaryrefslogtreecommitdiff
path: root/tests/listGroupBy.ur
blob: c2419ce17523b7cc5d120336136a1fc915e1bab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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>