From 1572515e8d3e1cf202fcaf7dec4f46ad7fd930f6 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 25 Aug 2016 22:14:16 +0200 Subject: Added examples --- examples/list-test.fusp | 2 ++ examples/list.fusp | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 examples/list-test.fusp create mode 100644 examples/list.fusp 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; -- cgit v1.2.3