Add corecursive func test
This commit is contained in:
parent
4f514378ac
commit
0f9c1f4eb4
14
test/corecursive_func.tm
Normal file
14
test/corecursive_func.tm
Normal file
@ -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"]
|
Loading…
Reference in New Issue
Block a user