Question: Write the following functions in Haskell isSubsequence:: (Eq a) => [a] rightarrow [a] rightarrow Bool. Is the first argument a subsequence of the second one?

Write the following functions in Haskell

Write the following functions in Haskell isSubsequence:: (Eq a) => [a] rightarrow

isSubsequence:: (Eq a) => [a] rightarrow [a] rightarrow Bool. Is the first argument a subsequence of the second one? *Code> isSubsequence [3, 4] [1, 2, 3, 4, 5] True *Code> isSubsequence [2, 4] [1, 2, 3, 4, 5] False *Code> isSubsequence [] [1, 2, 3, 4, 5] True *Code> isSubsequence [4, 3, 2] [1, 2, 3, 4, 5] False *Code> indexof:: (Eq a) => [a] rightarrow [a] rightarrow Maybe Int. Find the index where the first argument begins as a subsequence of the second argument, if there is such an index. Return Just the index when found, or Nothing when the index doesn't exist. Indexing begins at zero. *Code> indexof [2, 3] [1, 2, 3, 4, 5] Just 1 *Code> indexof [3, 4, 5] [1, 2, 3, 4, 5] Just 2 *Code> indexof [2, 4] [1, 2, 3, 4, 5] Nothing

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!