From: Mart Lubbers Date: Tue, 10 Mar 2015 10:18:55 +0000 (+0100) Subject: week 5 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=fb246775fd071894d431780f4b990743bf40978e;p=fp1415.git week 5 --- diff --git a/week5/mart/Origami.icl b/week5/mart/Origami.icl new file mode 100644 index 0000000..56fdb86 --- /dev/null +++ b/week5/mart/Origami.icl @@ -0,0 +1,11 @@ +module Origami + +import StdEnv + +sum` = foldr (+) 0 +prod` = foldr (*) 1 +flatten` = foldr (++) [] +length` = foldr (\x l=l+1) 0 +reverse` = foldl (\xs x=[x:xs]) [] +takeWhile` p = foldr (\x xs=if (p x) [x:xs] []) [] +maxList` = foldr (\x m=if (m