Perform set operation: union, intersection, and difference.

Assignment Help Basic Computer Science
Reference no: EM13230222

You are to write Scheme functions in a pure functional style to perform set operation: union, intersection, and difference. You may assume that the input data are two simple lists representing sets. Test your program on the following data: (union ‘(a b c) ‘(b d e)) (union ‘(cat dog) ‘(bug)) (union ‘() ‘(a)) (union ‘( 1 3 5 7 ) ‘(2 3 4 6 8)) (inter ‘(a b c) ‘()) (inter ‘(cat dog bug) ‘(dog mouse sheep)) (inter ‘(a b c) ‘(x a y c)) (diff ‘(a b c) ‘(a b d e)) answer: (c) (diff ‘(1 2 3 4) ‘(9 5 2)) answer: (1 3 4) (diff ‘(1 2) ‘(3)) answer (1 2) ( union'(2 3 4)'(3 4 5 6) ) (Hint: Function inter() is given in your textbook. Function member() may need to be added by you. Function union can be done by checking whether car (list1) is a member of list2; if so, throw it away and continue; otherwise, cons it to result of the union of cdr(list1) and list2. Function differ() can be implemented in a similar way.) Print definition and get screen dump for the execution, also upload your functions to the portal. Note that comments should be added by adding a semicolon (;) as follows: (define (member atm l) ; check membership in a simple list .....) ; the rest of the body.

Reference no: EM13230222

Questions Cloud

What are the resultant values for the output period : A PWM unit is set-up with a pre-scale factor of 128. If the PWMPER register is loaded with 34 and the PWMDTY is loaded with 3, what are the resultant values for the output period and pulse width
Find the extension and retraction load-carrying capacities : An 8cm diameter hydraulic cylinder has a 4cm diameter rod. If the cylinder receives flow at 100Lpm and 12MPa, find the a) Extension and retraction speeds b) Extension and retraction load-carrying capacities
Explain the importance of unix : Explain the importance of UNIX® to the Internet. Support your position using examples.
Explain why goods analogy of a supply chain is inappropriate : Explain why the goods analogy of a supply chain is inappropriate for services (400-500 words)
Perform set operation: union, intersection, and difference. : You are to write Scheme functions in a pure functional style to perform set operation: union, intersection, and difference.
Describe the behaviors of leaders modeling excellence : Describe the behaviors of leaders modeling excellence. How do you assess excellence and how does that inspire you to perform at a higher level?
Is the graph based layout construction method : Is the Graph based layout construction method always produces Maximally Planar Graph & Maximally Planar weighted graph?
Create a gui application with jframe : Create a GUI application with JFrame that contains five labels describing reasons that a customer might not buy a specific product.
How many bags per run are optimal : How many bags per run are optimal and what would the average inventory be for this lot size?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Emerging market is using internet phone to replace pbx

Interesting emerging market is using Internet phone and company's high speed LAN to replace same company's PBX. Write a one page report on this issue.

  You are working for country club

You are working for country club with thousands of members. You have been tasked with designing a database to keep track of the members and their guests.

  Potential vulnerabilities in making purchase with debit card

Recognoze any potential vulnerabilities in making purchase with debit card, and which area of CIA triad they apply to.

  A static method that takes an array of integers as parameter

Write a static method that takes an array of integers as a parameter and returns back an integer that is the sum of all of the integers in the array.

  Ipo chart and pseudocode

Start by analyzing the problem; use an IPO chart and pseudocode (or flowchart) to brainstorm the logic prior to start coding. Using Visual Studio code and test your program according to your pseudocode solution. Once you are satisfied with your progr..

  Develop a program that will allow the district sales manager

You have been asked to develop a program that will allow the district sales manager to input each of the dealership's ID along with their four quarterly sales volumes for the year, calculate and display each quarter's rebate and the sales bonus fo..

  Calculate interest earned in one year

Calculate the interest earned in 1 year given starting account balance B and annual interest rate I and supposing simple interst, that is no compounding.

  List and describe three guidelines for sound policy

List and describe briefly the three guidelines for sound policy, as stated by Bergeron and Bérubé. Are policies different from standards? In what way? Are policies different from procedures? In what way?

  Extended grep for regular expressions

That contain the word "as" exactly onceb) that contain the word "sa" more than once

  User defined company class

Create a user defined Company class the class will include Company Name, Stock Symbol and stock value per share. Include a parameterized constructor and get methods for each of the instance variables. Also include a toString method.

  Describe graphical user interfaces-communications message

Describe some of the graphical user interfaces (GUIs) and communications messages that occur during operation of a microwave.

  Minimum number of edits required to convert string

Given two strings of size m, n and set of operations replace (R), insert (I) and delete (D) all at equal cost. Find minimum number of edits (operations) required to convert one string into another.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd