homework5

homework5 - Homework 5 CSC 4101, Fall 2011 Due: 1 December...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 5 CSC 4101, Fall 2011 Due: 1 December 2011 1. (10 pts) Write set membership test and set intersection 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 intersection 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 intersection takes two lists and returns a list representing the set intersection of the arguments. I.e., the result list contains all the elements that are in both argument lists. Similarly, write two ML functions member and intersection . For comparing individual ele- ments, you can use = . You can test these programs, but for submitting the homework, it’s good enough to have them on
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

homework5 - Homework 5 CSC 4101, Fall 2011 Due: 1 December...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online