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
Perform Dbscan Clustering and K means I have a simple array of data. I need to perform dbscan clustering and k means based on the values in the array.detailed description  bel

I have 9 assignments to be completed

1.  Use mathematical induction to prove Whenever n is a positive integer. 2.  Use loop invariant to prove that the program for computing the sum of 1,...,n is correct.

I am trying to get right side triangle in visual logic using for loop

What are Relative URLS ? When a web browser reads an HTML document, it has a great deal of information about the document. This includes the protocol used to retrieve the docu

'This program compares interest rates between two banks and determines the best bank 'Eric Weber, Adam Litchfield, Eric Romero, Sarah, Alex, Amy '10/5/12 'Lab #4 Problem 42 'CSC

Expertsmind brings you unique solution in java assignments Applet In processing, and the apple company is any little application that works one specific process that works

Write a script called 'prob1.m' that solves for the variables y, and z in terms of a user inputed x. The variables y and z are defined as follows: y = x - 30                when

Write a program that will input two numbers from the keyboard and execute each of the signed and unsigned multiply and divide instructions.  For each instruction, the program shoul

This section is proposed to be a catch all for several of the fundamental concepts which are used occasionally in working with systems of differential equations. There will not be