11 lines
336 B
Haskell
11 lines
336 B
Haskell
|
-- Version 1
|
||
|
evenSum :: [Integer] -> Integer
|
||
|
evenSum l = accumSum 0 l
|
||
|
accumSum n l = if l == []
|
||
|
then n
|
||
|
else let x = head l
|
||
|
xs = tail l
|
||
|
in if even x
|
||
|
then accumSum (n+x) xs
|
||
|
else accumSum n xs
|