comparison 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
comparison
equal deleted inserted replaced
953:301530da2062 954:2a50da66ffd8
1 fun one () = return 1
2
3 fun addEm n =
4 if n = 0 then
5 return 0
6 else
7 n1 <- rpc (one ());
8 n2 <- addEm (n - 1);
9 return (n1 + n2)
10
11 fun main () =
12 s <- source 0;
13 return <xml><body onload={n <- addEm 3; set s n}>
14 <dyn signal={n <- signal s; return (txt n)}/>
15 </body></xml>