Write a function to construct the union of two sets the


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).

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a function to construct the union of two sets the
Reference No:- TGS02721503

Expected delivery within 24 Hours