Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago