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

Assignment Help:

(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


Related Discussions:- Define a procedure that takes a list as a single argument

Super ascii string cost in c++, Ask question #Minimum 100 A string S is sai...

Ask question #Minimum 100 A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets

Java, Write a program that repeatedly prompts for and reads a positive inte...

Write a program that repeatedly prompts for and reads a positive integer value n and then calculates and displays the nth Fibonacci number

Information management system, Write a detailed description on how you woul...

Write a detailed description on how you would go about planning information system for an organisation

Develop an application for airraid game, Extend the AirRaid game, so that t...

Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

DOM - Document Object Model, What is DOM? The Document Object Model is a pl...

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

Define the syntax of for loop, Define the Syntax of FOR Loop? The unive...

Define the Syntax of FOR Loop? The universal form of this statement is for(initialization;condition;increment/decrement)             { statements;             }

Game, How to make game in pascal language

How to make game in pascal language

Store an url in a dartabase, how to store an url in a dartabase(sql server ...

how to store an url in a dartabase(sql server 2005)? (or) create table b(url what is the datatype for url?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd