Permalink
Browse files

Added reduce.hs

  • Loading branch information...
1 parent b6aebc2 commit 1b0ec7284cf6cb01958783162b4235310fd9c540 @duckinator committed Oct 30, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 reduce.hs
View
@@ -0,0 +1,9 @@
+reduce _ start [] = start
+reduce fn start rest = reduce fn (fn start (head rest)) (tail rest)
+
+x = reduce (+) 0 [1,2,3,4,5,6,7]
+y = reduce (-) 28 [1,2,3,4,5,6,7]
+
+main = do putStrLn (show x)
+ putStrLn (show y)
+

0 comments on commit 1b0ec72

Please sign in to comment.