aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-08-25 22:14:16 +0200
committerCamil Staps2016-08-25 22:14:16 +0200
commit1572515e8d3e1cf202fcaf7dec4f46ad7fd930f6 (patch)
tree5692b7fdb20dec02261c3e6ea19e718118a8c7e3
parentFix erroneous freeing (diff)
Added 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;