Question: 1. (10 pts) Write set membership test and set union programs in each of the languages Scheme and ML. Each function will only be about

 1. (10 pts) Write set membership test and set union programs

1. (10 pts) Write set membership test and set union programs in each of the languages Scheme and ML. Each function will only be about two or three lines long. As data structure for sets, we will use unordered lists. E.g., the Scheme list (11 15 3) represents the set 3, 11, 15). Each element should appear only once in the set. Write Scheme functions memv? and union of the following types. The boolean function memv? takes an element and a list and returns true if and only if the element is in the list. Use the comparison eqv? for comparing individual elements. The function union takes two lists and returns a list representing the set union of the arguments. L.e., the result list contains all the elements that are in either argument list. Similarly, write two ML functions member and union. For comparing individual elements, you can use =. 1. (10 pts) Write set membership test and set union programs in each of the languages Scheme and ML. Each function will only be about two or three lines long. As data structure for sets, we will use unordered lists. E.g., the Scheme list (11 15 3) represents the set 3, 11, 15). Each element should appear only once in the set. Write Scheme functions memv? and union of the following types. The boolean function memv? takes an element and a list and returns true if and only if the element is in the list. Use the comparison eqv? for comparing individual elements. The function union takes two lists and returns a list representing the set union of the arguments. L.e., the result list contains all the elements that are in either argument list. Similarly, write two ML functions member and union. For comparing individual elements, you can use =

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!