repositories
/
fp1415.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6352357
)
week5
author
Mart Lubbers
<mart@martlubbers.net>
Fri, 13 Mar 2015 14:33:27 +0000
(15:33 +0100)
committer
Mart Lubbers
<mart@martlubbers.net>
Fri, 13 Mar 2015 14:33:27 +0000
(15:33 +0100)
week5/mart/Origami.icl
patch
|
blob
|
history
diff --git
a/week5/mart/Origami.icl
b/week5/mart/Origami.icl
index
56fdb86
..
93d36ef
100644
(file)
--- a/
week5/mart/Origami.icl
+++ b/
week5/mart/Origami.icl
@@
-2,10
+2,10
@@
module Origami
\r
import StdEnv
\r
\r
-sum`
= foldr (+) 0
\r
-prod`
= foldr (*) 1
\r
-flatten`
= foldr (++) []
\r
-length`
= foldr (\x l=l+1) 0
\r
-reverse`
= foldl (\xs x=[x:xs]) []
\r
+sum` = foldr (+) 0
\r
+prod` = foldr (*) 1
\r
+flatten` = foldr (++) []
\r
+length` = foldr (\x l=l+1) 0
\r
+reverse` = foldl (\xs x=[x:xs]) []
\r
takeWhile` p = foldr (\x xs=if (p x) [x:xs] []) []
\r
-maxList`
= foldr (\x m=if (m<x) x m) 0
\r
+maxList`
[x:xs] = foldr max x xs
\r