Write a function to construct the union of two sets

Assignment Help Programming Languages
Reference no: EM131926028

SML/ML Programming Problems -

Problem 1 - Define a function member of type ''a * ''a list -> bool so that member(e,L) is true if and only if e is an element of the list L.

Provide code and 3 varied tests.

Problem 2 - Write a function to construct the union of two sets.

The union of two sets is an unordered listing of elements without repetitions.

You may find it useful to call member in your solution.

Provide code and 3 varied tests.

Problem 3 - Represent a polynomial using a list of its (real) coefficients, starting with the constant coefficient and going only as high as necessary. For example, 3x2 + 5x + 1 would be represented as the list [1.0,5.0,3.0] and x3 - 2x as [0.0,~2.0,0.0,1.0].

Write a function polyeval of type real list * real -> real that takes a polynomial represented this way and a value for x and returns the value of that polynomial at the given x. For example, polyeval ([1.0,5.0,3.0],2.0) should evaluate to 23.0, because when x = 2, 3x2 + 5x + 1 = 23.

You may find it useful to write a helper function(s).

Provide code and 5 varied tests and show outputs' correctness (e.g., when x = 2, 3x2 + 5x + 1 = 3(22) + 5(2) + 1 = 12 + 10 + 1 = 23).

Reference no: EM131926028

Questions Cloud

Full web address of the testimony : Search the USHMM site (or Yad Vashem, the USC Shoah Foundation, or other credible online source) for a survivor testimony
Reflect on your theological foundation : Articulate the significance of identifying first, second, and third order Christian doctrines as you begin to dialogue with opposing theological views.
Find a security case study regarding a hack or data breach : Find a security case study regarding a hack or data breach that shouldn't have happened.
Design to create a patient satisfaction survey : you use best practices of survey design to create a patient satisfaction survey - Using best practices of survey design, create a 15-question patient
Write a function to construct the union of two sets : Write a function to construct the union of two sets. The union of two sets is an unordered listing of elements without repetitions
Which stock has greater market risk : If rf were constant at 6.8% and the regression had been run using total rather than excess returns, what would have been the regression intercept for stock A?
Revolve around the idea of self-recongnization : The concepts of both articles revolve around the idea of self-recongnization in manta rays, each article attempts to convey the cognitive powers of these animal
How would the given customer be classified : Specify the success class as 1 (loan acceptance), and use the default cutoff value of 0.5. How would this customer be classified?
What is the role of individual in helping to solve problem : Are we more likely to solve the problems if we embrace a sense of common purpose and public spirit focused on the collective good?

Reviews

Write a Review

Programming Languages Questions & Answers

  An sql query that will display all of the database fields.

An SQL database containing the fields in the current Chart of Accounts, plus a "balance" field.

  Find the date format is valid or not

Display the date and message that indicates whether it is valid. If it is not valid, also display a message explaining why it is not valid.

  Determine maths function in sql

Calculate the average salary for employees for each state.

  Write program to evaluate young worker-s earning

Write down a program to evaluate how much young worker will make before retiring at age 65. Request worker's name, age, and starting salary as input.

  Write a program that reads and processes data

Write a program that reads and processes data about quarterly rainfall for one year. Your program should ask the user to enter rain fall amounts for each of the four quarters in the year.

  How you may be able to pass variables in your program

Describe in detail how you may be able to pass variables in your program and elaborate with code-specific syntax as to the required keywords for each of the different ways to pass variables in your program

  Design a c# windows phone 8 application

Design and implement a C# Windows Phone 8 application based on the SoundBoard app in the Windows Phone 8 Development for Absolute Beginners textbook.

  Create a project in visual c++ add numberlist.h

Create a project in Visual C++, Add NumberList.h and NumberList.cpp files to your project. These are included in the zip file with this document. The files are code fr..

  Prepare calculator application - mock objects for testing

Which other classes do you think will need to be stubbed with mock objects for testing the application? For each class you identify explain why you think that class needs mocking and at least three di erent mocked behaviours you will need.

  Write program for real estate agent

Write a program for a real estate agent. The program should perform the following tasks: ask users for the average house price for the each of past 5 years for a single family residence of 1500 square feet.

  Write sql statements

Write a SQL statement to display the Major of students with no duplications. Do not display student names.

  Identify the tokens in each of the given statement

Identify the tokens in the following statement. (You do not need to classify them; just identify them.) a. if (a == b1) a = x + y.

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