You are to write scheme functions in a pure functional


You are to write Scheme functions in a pure functional style to perform set operation: union, intersection, and difference. You may assume that the input data are two simple lists representing sets. Test your program on the following data: (union ‘(a b c) ‘(b d e)) (union ‘(cat dog) ‘(bug)) (union ‘() ‘(a)) (union ‘( 1 3 5 7 ) ‘(2 3 4 6 8)) (inter ‘(a b c) ‘()) (inter ‘(cat dog bug) ‘(dog mouse sheep)) (inter ‘(a b c) ‘(x a y c)) (diff ‘(a b c) ‘(a b d e)) answer: (c) (diff ‘(1 2 3 4) ‘(9 5 2)) answer: (1 3 4) (diff ‘(1 2) ‘(3)) answer (1 2) ( union'(2 3 4)'(3 4 5 6) ) (Hint: Function inter() is given in your textbook. Function member() may need to be added by you. Function union can be done by checking whether car (list1) is a member of list2; if so, throw it away and continue; otherwise, cons it to result of the union of cdr(list1) and list2. Function differ() can be implemented in a similar way.) Print definition and get screen dump for the execution, also upload your functions to the portal. Note that comments should be added by adding a semicolon (;) as follows: (define (member atm l) ; check membership in a simple list .....) ; the rest of the body.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: You are to write scheme functions in a pure functional
Reference No:- TGS0566706

Expected delivery within 24 Hours