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 | bd572fc6e38f48574c8aa67e251ff1c184a6d340 (patch) | |
tree | 826cbdb7565674b7e6c1e8161bce1f4d5655a942 /tests/fact.ur | |
parent | 072f65fcad6abc1b323e3897a22b8d05f4bc6baf (diff) |
Compile self-tail-calls as gotos
Diffstat (limited to 'tests/fact.ur')
-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> |