]> Nishi Git Mirror - gwion.git/commitdiff
:white_check_mark: Simplify tail call test
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Sat, 16 May 2020 11:54:26 +0000 (13:54 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Sat, 16 May 2020 11:54:26 +0000 (13:54 +0200)
examples/tail_call.gw

index 0a595ebdbbb1242b920dac5430ac013ade7a4811..fbbf9d5ed41a892b70d16dedb552a7d0ec695efc 100644 (file)
@@ -1,8 +1,8 @@
 fun void test(int i) {
-  if(i == 2)return;
-#!  if(i == 0)return;
-<<< i >>>;
-  return test(--i + 3 - 4);
+  if(!i)
+    return;
+  <<< i >>>;
+  return test(--i);
 }
 
-test(6);
+test(3);