This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
CIS194/Lecture 01/scratch/sumFun.hs

11 lines
187 B
Haskell

sumFun :: Integer -> Integer
sumFun 0 = 0
sumFun n
| n < 0 = 0
| otherwise = sumFun(n - 1) + n
sumList :: Integer -> [Integer]
sumList 0 = []
sumList n = sumFun(n) : sumList(n - 1)