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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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