aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/rosetta/mutual_recursion.bruijn
diff options
context:
space:
mode:
Diffstat (limited to 'samples/rosetta/mutual_recursion.bruijn')
-rw-r--r--samples/rosetta/mutual_recursion.bruijn20
1 files changed, 20 insertions, 0 deletions
diff --git a/samples/rosetta/mutual_recursion.bruijn b/samples/rosetta/mutual_recursion.bruijn
new file mode 100644
index 0000000..3feb143
--- /dev/null
+++ b/samples/rosetta/mutual_recursion.bruijn
@@ -0,0 +1,20 @@
+:import std/Combinator .
+:import std/Number .
+:import std/List .
+
+f' [[[=?0 (+1) (0 - (1 (2 --0)))]]]
+
+m' [[[=?0 (+0) (0 - (2 (1 --0)))]]]
+
+f ^(y* (f' : {}m'))
+
+m _(y* (f' : {}m'))
+
+:test ((f (+0)) =? (+1)) ([[1]])
+:test ((m (+0)) =? (+0)) ([[1]])
+:test ((f (+4)) =? (+3)) ([[1]])
+:test ((m (+4)) =? (+2)) ([[1]])
+:test ((f (+15)) =? (+9)) ([[1]])
+:test ((m (+15)) =? (+9)) ([[1]])
+
+main [[0]]