Mercurial > urweb
annotate tests/tail.ur @ 1455:913d9c2f55c9
Corify Basis.unit to empty record; this is needed so that specialize
can see that they are equivalent.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Fri, 06 May 2011 16:24:45 -0430 |
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> |