Skip to content

Commit b47ad6b

Browse files
authored
Merge pull request #209 from petertseng/accumulate-example
accumulate: fix inefficient example
2 parents 67533af + c7e0080 commit b47ad6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exercises/accumulate/src/Example.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ accumulate f xs = [f x | x <- xs]
1414
1515
-- Commonly submitted inefficient solution (we test for this now):
1616
17-
accumulate f xs = accumulate' []
17+
accumulate f = accumulate' []
1818
where
19-
accumulate' acc [] = acc
19+
accumulate' acc [] = reverse acc
2020
accumulate' acc (x:xs) = accumulate' (f x : acc) xs
2121
2222
-}

0 commit comments

Comments
 (0)