a define a procedure subsets x that takes a list


(a) Define a procedure (subsets x) that takes a list as a single argument and returns all 2^n subsets of that list, i.e. the power set of the list;

e.g. (subsets '(a b c)) ==> (() (c) (b) (b c) (a) (a c) (a b) (a b c))             

The order of the subsets returned is not important.

(b) Define an iterative function (filter pred lst) that applies a predicate pred to each element of a list lst and returns a list of elements that satisfy the predicate; e.g. (filter even? '(1 2 3 4 5 6)) ==> (2 4 6).

(c) Define a procedure (interleave x y) that takes 2 list arguments and returns the 2 lists interleaved; e.g. (interleave '(a b c) '(d e f)) => (a d b e c f).

You must deal with the case when the two lists are not of equal

Request for Solution File

Ask an Expert for Answer!!
Application Programming: a define a procedure subsets x that takes a list
Reference No:- TGS0220942

Expected delivery within 24 Hours