diff options
author | Camil Staps | 2018-04-03 20:06:13 +0200 |
---|---|---|
committer | Camil Staps | 2018-04-03 20:06:13 +0200 |
commit | b5917471efab37e60949b380a24ecc35e2946203 (patch) | |
tree | e1359698e10bad08ac2c32e625d062ba8773b83f /examples/list.fusp | |
parent | Beautify Makefile (diff) |
Extend examples
Diffstat (limited to 'examples/list.fusp')
-rw-r--r-- | examples/list.fusp | 5 |
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)]; |