diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-08-02 17:04:14 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-08-02 17:04:14 -0400 |
commit | b219af5f765fbc789a7f54f50862e6730ae141fd (patch) | |
tree | 826cbdb7565674b7e6c1e8161bce1f4d5655a942 /tests | |
parent | 1a96e18000db336129e0a99e3c86e7a57f152402 (diff) |
Compile self-tail-calls as gotos
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fact.ur | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/fact.ur b/tests/fact.ur new file mode 100644 index 00000000..c7989a3b --- /dev/null +++ b/tests/fact.ur @@ -0,0 +1,5 @@ +fun fact n = if n <= 1 then 1 else n * fact (n - 1) + +fun factTr n acc = if n <= 1 then acc else factTr (n - 1) (n * acc) + +fun main () : transaction page = return <xml>{[fact 10]}, {[factTr 10 1]}</xml> |