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 1 to the remaining digits in the credit card
number.
c If the result mod 10 is equal to 0, the number is valid. If the result mod10 is
not equal to 0, the validation fails. This is the code i have so far but it dosen't work: validate :: Int -> Bool
validate n
| sumDigits (doubleEveryOther (toDigitRev n))`myMod`10==0= True
| otherwise = False
 (IN HASKELL) Using the above written functions, create a validate function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!