Mercurial > urweb
annotate tests/tail.ur @ 981:27a3412d23e4
Fix sel() generation bug
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 24 Sep 2009 12:26:30 -0400 |
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> |