aboutsummaryrefslogtreecommitdiff
path: root/test/corecursive_func.tm
blob: b5f5f13e00e7bcf8fa7b38b8898afec388e5ed29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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"]

func main():
	>> ping(3)
	= ["ping: 3", "pong: 2", "ping: 1", "pong: 0"]