Question: Using Haskell 1. Define function findInd :: (Eq a) => a -> [a] -> Int that receives an item and a list and returns the
Using Haskell
1. Define function findInd :: (Eq a) => a -> [a] -> Int that receives an item and a list and returns the index in the list where the input item resides. If the item is not in the list, it must raise an exception. For example,findInd 7 [5..20]must return2, whereas findInd3 [5..20]must raise an exception.Note: You cannot use the built-in function elemIndex.Hint: You may need to define a helper function that keeps track of indexes as it traverses the input list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
