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

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!