Credit card number validation

This commit is contained in:
Michael Mandl 2016-09-22 23:50:31 +02:00
parent ab98b7cf3d
commit 566bdfc66c
3 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,3 @@
isEven :: Integer -> Bool
isEven n = n `mod` 2 == 0

View file

@ -0,0 +1,10 @@
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)