Mercurial > urweb
diff tests/tail.ur @ 954:2a50da66ffd8
Basic tail recursion introduction seems to be working
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Sep 2009 16:35:11 -0400 |
parents | |
children | d80734855790 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/tail.ur Thu Sep 17 16:35:11 2009 -0400 @@ -0,0 +1,15 @@ +fun one () = return 1 + +fun addEm n = + if n = 0 then + return 0 + else + n1 <- rpc (one ()); + n2 <- addEm (n - 1); + return (n1 + n2) + +fun main () = + s <- source 0; + return <xml><body onload={n <- addEm 3; set s n}> + <dyn signal={n <- signal s; return (txt n)}/> + </body></xml>