CMPU-145, Spring 2013 Lab 2 Feb. 11, 2013 Begin by creating a lab2 directory in your own CS account. Download the file "asmt-helper.txt" into your lab2 directory. Start up DrScheme and create a nice looking definitions file. Be sure to: (1) include a comment section at the top that shows the name of the course, the lab number, and your name; (2) insert (load "asmt-helper.txt") near the top of your file; and (3) save your definitions as plain text, giving the file a name like "b-obama-lab-2-defns.txt". You can use the definitions file (solutions) from Lab1 as an example. HINTS: -- You may use built-in function such as REVERSE, REMOVE or MAP, if you want to. -- You may define helper function (e.g., accumulator-based helpers) if you want to. -- You may want to use LET* sometimes. PROBLEM 1 Define a function, called RANGE, that takes a binary relation (i.e., a list of pairs) as its only input. It should return as its output a list representing the range of that relation (i.e., the set of all b's for which there is at least one pair of the form (a,b) in the given relation), as illustrated below. > (range '((1 a) (2 b) (3 c) (2 d) (2 c) (3 a) (3 f) (2 e))) (e f d c b a) > (range '((1 2) (2 2) (3 2) (4 2))) (2) Note that the order of the items in the output list does not matter. PROBLEM 2 Define a function, called CONVERSE, that takes a binary relation (i.e., a list of pairs) as its only input. It should return as its output a list of pairs representing the converse of that relation (i.e., the set of all pairs, (b,a), for which (a,b) appears in the input relation), as illustrated below. > (converse '((1 2) (3 4) (5 6))) ((2 1) (4 3) (6 5)) > (converse '((1 a) (2 b) (3 c) (3 d) (3 e) (2 c))) ((a 1) (b 2) (c 3) (d 3) (e 3) (c 2)) PROBLEM 3 Define a function, called SYMMETRIC?, that takes as its only input a list of pairs representing a binary relation. It should return as its output a boolean value (i.e., #t or #f) indicating whether the given relation is symmetric, as illustrated below. > (symmetric? '((1 2) (3 3) (2 1))) #t > (symmetric? '((1 2) (3 4) (2 1) (4 5) (4 3))) #f WARNING!! Be sure that you properly deal with pairs such as (3,3).