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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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