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
Access Modifiers Convenience Modifiers or we can say (Access Specifies) identifies as the opportunity of accessibility of an Item and its associates. All C# kinds and kind associat

.NET class library .NET structure comes with just one category selection. And that all developers need to learn!! Whether they create the value in C# or VB.NET or J#, it doesn't

do you solve questions of assigments?

Go to the following link and please do Problem 6. This is in C language. http://wikisend.com/download/304748/hw%206.pdf The code I need must be in C language and not C++ . Thank

A psychologist is interested in learning about the voting behavior of college students.  (4 points for each part.)Design a study which would yield data on this topic. a. state y

how can we get the data from data base to combo box in jsp page dynamically

Question: (a) Explain the concepts of Inheritance and Polymorphism in Lingo programming. (b) Write short descriptions on parent scripts and child objects in Lingo object

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

Why no Audible support for Linux? Maybe they should use a browser interface?

Write out the Syntax of Nested if Statements? The universal form is                         If(expression 1)                         {