aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-10 11:53:18 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-10 11:53:18 -0400
commit0f9c1f4eb4fcbabec313d13205ef81e47fd8456c (patch)
tree2da7b0b41f5d2da6f80e3051f762363194f9db32 /test
parent4f514378accd7a5ed8774d008761efa94f383148 (diff)
Add corecursive func test
Diffstat (limited to 'test')
-rw-r--r--test/corecursive_func.tm14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/corecursive_func.tm b/test/corecursive_func.tm
new file mode 100644
index 00000000..0ff92e53
--- /dev/null
+++ b/test/corecursive_func.tm
@@ -0,0 +1,14 @@
+func ping(x:Int)->[Text]
+ if x > 0
+ return ["ping: {x}"] ++ pong(x-1)
+ else
+ return ["ping: {x}"]
+
+func pong(x:Int)->[Text]
+ if x > 0
+ return ["pong: {x}"] ++ ping(x-1)
+ else
+ return ["pong: {x}"]
+
+>> ping(3)
+= ["ping: 3", "pong: 2", "ping: 1", "pong: 0"]