Question: In Haskell A)Implement a search algorithm that searches through a list for Int n and returns the value in the list after n. If there
In Haskell
A)Implement a search algorithm that searches through a list for Int n and returns the value in the list after n. If there is no value, or the list is empty, return -1. E.g., findNext 5 [1,2,3,4,5,6] should return 6, while findNext 5 [0, 10, 20, 30] returns -1. 2 pts)
B)Implement a search algorithm that searches through a list for Int n and returns the value in the list before n. If there is no value, or the list is empty, return -1. E.g., findPrev 5 [1,2,3,4,5,6] should return 4, while findPrev 5 [0, 10, 20, 30] returns -1. 4pts)
C)Implement function that calculates a digit sum of an Int --- adds all the digits of the int together, returning an Int. You can define a second helper function. At least one of your functions must use recursion. Include type definitions for all functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
