Define a procedure that takes a list as a single argument, Programming Languages

(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

Posted Date: 3/30/2013 6:24:43 AM | Location : United States







Related Discussions:- Define a procedure that takes a list as a single argument, Assignment Help, Ask Question on Define a procedure that takes a list as a single argument, Get Answer, Expert's Help, Define a procedure that takes a list as a single argument Discussions

Write discussion on Define a procedure that takes a list as a single argument
Your posts are moderated
Related Questions
Am unable to write to file of type=file in perl script.It does not have any extension.Help me..

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Question 1: a) Assume that B is an array of 50 words; write a code which will place the smallest integer of array B in register AX. b) Write a small code (only three instr

Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

What is DOM? The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure an

how to make a program using vb?seriously i don''t know

Need help with my assignment

In this portion of the lab you will analyze a problem and create a Raptor program to solve it.  Make sure you use a class in Raptor and in Python to solve the problem.  Read the fo

about how to create the program in c

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit