aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--examples/ackermann.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..378eac2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+build
diff --git a/examples/ackermann.c b/examples/ackermann.c
new file mode 100644
index 0000000..08acd4d
--- /dev/null
+++ b/examples/ackermann.c
@@ -0,0 +1,25 @@
+#include <csxbind.h>
+#include <stdio.h>
+
+
+int main()
+{
+ init();
+ char *m = N("m");
+ char *n = N("n");
+ char *ackermann = N("ackermann");
+ printf("%d\n", *(int *)R(L(_do,
+ L(set, ackermann, L(fn, L(m, n, 0),
+ L(_if,
+ L(same, m, I(0), 0), L(_plus, n, I(1), 0),
+ L(same, n, I(0), 0), L(ackermann, L(_plus, m, I(-1), 0), I(1), 0),
+ L(ackermann,
+ L(_plus, m, I(-1), 0),
+ L(ackermann, m, L(_plus, n, I(-1), 0), 0),
+ 0),
+ 0),
+ 0), 0),
+ L(ackermann, I(3), I(7), 0),
+ 0)));
+ return 0;
+}