repositories
/
fp1415.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f42b97
)
week 5
author
Mart Lubbers
<mart@martlubbers.net>
Tue, 10 Mar 2015 10:18:55 +0000
(11:18 +0100)
committer
Mart Lubbers
<mart@martlubbers.net>
Tue, 10 Mar 2015 10:18:55 +0000
(11:18 +0100)
week5/mart/Origami.icl
[new file with mode: 0644]
patch
|
blob
diff --git a/week5/mart/Origami.icl
b/week5/mart/Origami.icl
new file mode 100644
(file)
index 0000000..
56fdb86
--- /dev/null
+++ b/
week5/mart/Origami.icl
@@ -0,0
+1,11
@@
+module Origami
\r
+
\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
+takeWhile` p = foldr (\x xs=if (p x) [x:xs] []) []
\r
+maxList` = foldr (\x m=if (m<x) x m) 0
\r