Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I would some help with this which is to Write all of your functions in a single Haskell file, please make sure they are written
I would some help with this which is to Write all of your functions in a single Haskell file, please make sure they are written in HASKELL. Thanks for the help.
Write all of your functions in a single Haskell file, which you will submit via Blackboard. You can load your file into the GHCi interactive system using :1. You do not need to provide a main or other interface. Your functions will be tested by loading them into an interactive session and passing them through HUnit tests. 1. (3 points) Write a function elem' which takes an arbitrary item of an Eq type and a list of the same type, and returns true if the item is in the list and false otherwise. For example: elem' 1 [l -> False elem' 4 [1, 2, 3] -> False elem' 'c' "abc" -> True 2. (3 points) Write a function intersect that takes two lists and returns the intersection of two lists. If either list contains duplicate entries the output may contain duplicates as well (if appropriate). If you function does not produce duplicates, even if they are present, it will earn 2 bonus points. For example: intersect [1] [1] -> [1] intersect [1, 2, 3] [1, 2] intersect [ [1, 2, 3], [1, -> 2], [1, 2] [2, 3] ] [ [1], [2, 3] ] -> [[2,3]] Write all of your functions in a single Haskell file, which you will submit via Blackboard. You can load your file into the GHCi interactive system using :1. You do not need to provide a main or other interface. Your functions will be tested by loading them into an interactive session and passing them through HUnit tests. 1. (3 points) Write a function elem' which takes an arbitrary item of an Eq type and a list of the same type, and returns true if the item is in the list and false otherwise. For example: elem' 1 [l -> False elem' 4 [1, 2, 3] -> False elem' 'c' "abc" -> True 2. (3 points) Write a function intersect that takes two lists and returns the intersection of two lists. If either list contains duplicate entries the output may contain duplicates as well (if appropriate). If you function does not produce duplicates, even if they are present, it will earn 2 bonus points. For example: intersect [1] [1] -> [1] intersect [1, 2, 3] [1, 2] intersect [ [1, 2, 3], [1, -> 2], [1, 2] [2, 3] ] [ [1], [2, 3] ] -> [[2,3]]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