From a7d7542dc646a5fd124ef71e71ce260889f1701b Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 2 Feb 2016 19:24:50 +0100 Subject: Moved to 1415 directory --- 1415/fp1/week5/mart/Origami.icl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 1415/fp1/week5/mart/Origami.icl (limited to '1415/fp1/week5/mart') diff --git a/1415/fp1/week5/mart/Origami.icl b/1415/fp1/week5/mart/Origami.icl new file mode 100644 index 0000000..180a119 --- /dev/null +++ b/1415/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