aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/list-test.fusp2
-rw-r--r--examples/list.fusp11
2 files changed, 13 insertions, 0 deletions
diff --git a/examples/list-test.fusp b/examples/list-test.fusp
new file mode 100644
index 0000000..e71e07d
--- /dev/null
+++ b/examples/list-test.fusp
@@ -0,0 +1,2 @@
+main = flatten [[1:[2:[3:[]]]]:[[4:[5:[6:[]]]]:[]]];
+main = append [1:[2:[3:[]]]] [4:[5:[6:[]]]];
diff --git a/examples/list.fusp b/examples/list.fusp
new file mode 100644
index 0000000..2fce492
--- /dev/null
+++ b/examples/list.fusp
@@ -0,0 +1,11 @@
+append [] ys = ys;
+append [x:xs] ys = [x:append xs ys];
+
+flatten [] = [];
+flatten [h:t] = append h (flatten t);
+
+isEmpty [] = 1;
+isEmpty _ = 0;
+
+hd [x:_] = x;
+tl [_:x] = x;