From 6f604b19d3f5966e5c1d7c4fdf3703bd6ff0861c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 16 Apr 2015 21:22:20 +0200 Subject: update to fp2 yay, public and licence --- fp1/week5/mart/Origami.icl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 fp1/week5/mart/Origami.icl (limited to 'fp1/week5/mart') diff --git a/fp1/week5/mart/Origami.icl b/fp1/week5/mart/Origami.icl new file mode 100644 index 0000000..180a119 --- /dev/null +++ b/fp1/week5/mart/Origami.icl @@ -0,0 +1,16 @@ +/** + * Mart Lubbers, s4109503 + * Camil Staps, s4498062 + */ + +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` [x:xs] = foldr max x xs -- cgit v1.2.3