So i\'m not too sure how to phrase this properly, but say I wanted to get the sum of all odd numbers in a list, do I have two functions (sumList and getOddNumbers) and combi
In the following are three equivalent ways to write the function oddSum :: [Integer] -> Integer
:
oddSum xs = sumList (getOddNumbers xs)
oddSum xs = sumList $ getOddNumbers xs
oddSum = sumList . getOddNumbers
Btw, have a look at the filter
and sum
functions in the Prelude with which you could replace getOddNumbers
and sumList
respectively.