Credit card number validation
This commit is contained in:
parent
ab98b7cf3d
commit
566bdfc66c
3 changed files with 45 additions and 0 deletions
3
Lecture 01/scratch/isEven.hs
Normal file
3
Lecture 01/scratch/isEven.hs
Normal file
|
@ -0,0 +1,3 @@
|
|||
isEven :: Integer -> Bool
|
||||
isEven n = n `mod` 2 == 0
|
||||
|
10
Lecture 01/scratch/sumFun.hs
Normal file
10
Lecture 01/scratch/sumFun.hs
Normal 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)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue