Question: Using Simple Haskell Programming and Lambda Calculus Problem 3. (5+10 Points) The Luhn algorithm is used to check bank card numbers for simple errors such

 Using Simple Haskell Programming and Lambda Calculus Problem 3. (5+10 Points)

Using Simple Haskell Programming and Lambda Calculus

Problem 3. (5+10 Points) The Luhn algorithm is used to check bank card numbers for simple errors such as mistyping a digit, and proceeds as follows - Consider each digit as a separate number Moving right-to-left and beginning at the second last digit, double every other number Subtract 9 from each number that is now greater than 9 -Add all the resulting numbers together - If the total is divisible by 10, the card number is valid a) Define a function luhnDouble that doubles a digit and subtracts 9 if the result is greater than 9. For example: luhnDouble 3 6 > luhnDouble 6 b) Using luhnDouble, define a function luhn which decides if a four-digit bank card number is valid. For example: luhn 1784 True luhn 4 783 False

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!