aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/fix.fusp10
-rw-r--r--examples/func.fusp1
-rw-r--r--examples/scan_iterate.fusp5
3 files changed, 16 insertions, 0 deletions
diff --git a/examples/fix.fusp b/examples/fix.fusp
new file mode 100644
index 0000000..617f909
--- /dev/null
+++ b/examples/fix.fusp
@@ -0,0 +1,10 @@
+import bool;
+import int;
+
+fix f = fixb f (fixb f);
+fixb f x = f (x x);
+
+main = fix myadd 5 10;
+
+// Fixpoint peano integer addition
+myadd a m n = if (eq n 0) m (add 1 (a m (sub 1 n)));
diff --git a/examples/func.fusp b/examples/func.fusp
new file mode 100644
index 0000000..4441ccf
--- /dev/null
+++ b/examples/func.fusp
@@ -0,0 +1 @@
+flip f x y = f y x;
diff --git a/examples/scan_iterate.fusp b/examples/scan_iterate.fusp
new file mode 100644
index 0000000..a43effb
--- /dev/null
+++ b/examples/scan_iterate.fusp
@@ -0,0 +1,5 @@
+import func;
+import int;
+import list;
+
+main = [take 5 (iterate (flip pow 2) 2), scan mul 1 [3,4,5], scan add 0 [3,4,5]];