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

  Program for an automatic teller machine

Create a program for an automatic teller machine that dispenses money. The user should insert amount desired and the machine dispenses this amount using least number of bills.

  Develop leftmost and rightmost derivations

Develop leftmost and rightmost derivations respectively for the Identifier value S6T, using the following BNF syntax:

  Use double variable to represent the private data of class

Use double variable to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared.

  Explain hardware implementations of intelligent agents

There are hardware implementations of intelligent agents. Determine the literature instances of intelligent agents as software. Compare and contrast two implementations.

  Write the verilog code for a two-input, two-bit adder

Write the Verilog code for a two-input, two-bit adder. The inputs are to be set by switches SW0-SW3 the three-bit result is to be displayed on LED0-2. Then write the Verilog code to add two hexadecimal integers stored in 4 bits each.

  Create an array of integers 10 elements long

Create an array of integers 10 elements long. ? Loop through this array (using its length value), assigning a random value between 0 and 100 (inclusive) to each element. Remember: random(100) returns a float and will never return 100.0.

  Deployment and ongoing operation after implementations

Your plan requires two sections, one for deployment and another for ongoing operation after implementation. The vendor offers a contracting service for installation at $140 per hour.

  Determine the bit representation for each of the following

Determine the bit representation for each of the following for 32-bit floating point notation

  This assignment is an exercise

If you like, you may write private methods for the Queue class in addition to the methods described above. For example, you may want to write a copyList() method that can be called by both the copy constructor and overloaded assignment operator.

  Define a specialized representation language

Define a specialized representation language to describe the activities of a public library. This language will be a set of concepts and relations using conceptual graphs. Do the same thing for a retail business.

  Remember from lecture that using

Remember from lecture that using { and } creates a block of code within the condition instead of just one line.Also, not the use of single quotes instead of double quotes. (Double quotes signify a literal string while single quotes signify a literal ..

  Formula gives the distance between two points (

formula gives the distance between two points (x1, y1) and (x2, y2) in the Cartesian plane:

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