Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started