aboutsummaryrefslogtreecommitdiffhomepage
path: root/samples/rosetta/mutual_recursion.bruijn
diff options
context:
space:
mode:
authorMarvin Borner2024-03-14 13:53:46 +0100
committerMarvin Borner2024-03-14 13:53:46 +0100
commit0b77800262b5c46d994e6cb6159f773de8a05c51 (patch)
tree54e63cfea8fcc046072cb9e0028a12fd34937265 /samples/rosetta/mutual_recursion.bruijn
parent004f853f260d321753af32318ecdeb2c585af7b0 (diff)
More samples
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]]