Question: ( IN HASKELL ) Using the above written functions, create a validate function that will decide if a number is legal to use as credit
IN HASKELL Using the above written functions, create a validate function that will decide if a number
is legal to use as credit card using Luhn algorithm:
a Double the value of every other digit from right to left, beginning with the
second to last digit.
b Add the digits of the results of Step to the remaining digits in the credit card
number.
c If the result mod is equal to the number is valid. If the result mod is
not equal to the validation fails. This is the code i have so far but it dosen't work: validate :: Int Bool
validate n
sumDigits doubleEveryOther toDigitRev nmyMod True
otherwise False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
