aboutsummaryrefslogtreecommitdiff
path: root/examples/list.fusp
diff options
context:
space:
mode:
authorCamil Staps2018-04-03 20:06:13 +0200
committerCamil Staps2018-04-03 20:06:13 +0200
commitb5917471efab37e60949b380a24ecc35e2946203 (patch)
treee1359698e10bad08ac2c32e625d062ba8773b83f /examples/list.fusp
parentBeautify Makefile (diff)
Extend examples
Diffstat (limited to 'examples/list.fusp')
-rw-r--r--examples/list.fusp5
1 files changed, 5 insertions, 0 deletions
diff --git a/examples/list.fusp b/examples/list.fusp
index b3f4ea5..340eb6d 100644
--- a/examples/list.fusp
+++ b/examples/list.fusp
@@ -33,3 +33,8 @@ map f [x:xs] = [f x:map f xs];
take _ [] = [];
take 0 _ = [];
take n [x:xs] = [x:take (sub 1 n) xs];
+
+scan op r [] = [r];
+scan op r [a:x] = [r:scan op (op r a) x];
+
+iterate f x = [x:iterate f (f x)];