repositories
/
fp1415.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
week5
[fp1415.git]
/
week5
/
mart
/
Origami.icl
1
module Origami
2
3
import StdEnv
4
5
sum` = foldr (+) 0
6
prod` = foldr (*) 1
7
flatten` = foldr (++) []
8
length` = foldr (\x l=l+1) 0
9
reverse` = foldl (\xs x=[x:xs]) []
10
takeWhile` p = foldr (\x xs=if (p x) [x:xs] []) []
11
maxList` [x:xs] = foldr max x xs