Sum of Array: Difference between revisions
Content deleted Content added
→[[Haskell]]: that wasn't even valid syntax... |
→[[Haskell]]: better style |
||
Line 201: | Line 201: | ||
values = [1..10] :: [Int] |
values = [1..10] :: [Int] |
||
answer = sum values -- the easy way |
answer = sum values -- the easy way |
||
answer = foldl (+) 0 values -- the hard way |
answer' = foldl (+) 0 values -- the hard way |
||
==[[IDL]]== |
==[[IDL]]== |