Mercurial > urweb
annotate tests/tail.ur @ 1372:268d9af9103f
Basis.readUtc
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 28 Dec 2010 14:51:57 -0500 |
parents | d80734855790 |
children |
rev | line source |
---|---|
adamc@954 | 1 fun one () = return 1 |
adamc@954 | 2 |
adamc@954 | 3 fun addEm n = |
adamc@954 | 4 if n = 0 then |
adamc@954 | 5 return 0 |
adamc@954 | 6 else |
adamc@954 | 7 n1 <- rpc (one ()); |
adamc@954 | 8 n2 <- addEm (n - 1); |
adamc@954 | 9 return (n1 + n2) |
adamc@954 | 10 |
adamc@956 | 11 fun addEm' n acc = |
adamc@956 | 12 if n = 0 then |
adamc@956 | 13 return acc |
adamc@956 | 14 else |
adamc@956 | 15 n1 <- rpc (one ()); |
adamc@956 | 16 addEm' (n - 1) (n1 + acc) |
adamc@956 | 17 |
adamc@954 | 18 fun main () = |
adamc@954 | 19 s <- source 0; |
adamc@956 | 20 s' <- source 0; |
adamc@956 | 21 return <xml><body onload={n <- addEm 3; set s n; n <- addEm' 4 0; set s' n; alert "Welcome!"}> |
adamc@954 | 22 <dyn signal={n <- signal s; return (txt n)}/> |
adamc@956 | 23 <dyn signal={n <- signal s'; return (txt n)}/> |
adamc@954 | 24 </body></xml> |