Create a procedure that returns the last n items in the list

Assignment Help C/C++ Programming
Reference no: EM13881428

1. Create a procedure called (combine-four lst1lst2 lst3 lst4) that combines 4 lists into one list, in order of the given input lists.

2. Create a procedure that returns the last n items in the list lst.

3.1 Use a namedprocedure called (last-n lst n) to implement task.

3.2 Use an unnamedprocedure ((lambda (lst n) (. . .) '(1 6 3 4 5) 2) to implement task, where '(1 6 3 4 5) 2 are the arguments.

The unnamed procedure should give '(4 5)

3. Create a procedure called (first-nlst) that returns the first n items in the list lst. You must read in the value for n. You must not change the order of the list elements.

4. Create a procedure called (shuffle lst1 lst2) that returns a shuffle of two lists. Shuffle the lists by alternating elements between the two lists. You can assumethat both lists have the same length.

5. Create a procedure called (shufflePairs one two) that returns a shuffle of two lists in pairs. You can assume that both lists have the same length.

6. Create a procedure called (addSquare lst), where lst is a list of numbers. The procedure will calculate the square of each number in the list, add all the squared values, and then return the sum. If lst is empty, this procedure must return "empty list". If lst is not empty, the procedure should call another procedure called (addNonEmptyListlst) that returns the sum of square values of all elements in the lst. If lst is empty, (addNonEmptyListlst) procedure should return 0 (the value a the stopping condition). For example, (addSquare ‘(1 2 3)) should return the sum of 12 + 22 + 32

Note, you could use map function, but you do not have to use it.

Reference no: EM13881428

Questions Cloud

Explain how procurement cards provide for increased : Explain how procurement cards provide for increased efficiencies in the accounts payable department.
Prepare a journal entry that summarizes : Seven hundred vacation weeks earned in 2013 were not taken during 2013.
How are web browsers used in e-payables systems : How are Web browsers used in e-payables systems?
Explain why the availability of computer systems : Explain why the availability of computer systems in the receiving department is such an important component of an automated expenditures process.
Create a procedure that returns the last n items in the list : Create a procedure that returns the last n items in the list lst. Create a procedure called (combine-four lst1lst2 lst3 lst4) that combines 4 lists into one list, in order of the given input lists.
Identify compensating controls needed for an effective ers : Identify compensating controls needed for an effective ERS system.
Wellness event planning & promotion assignment : Wellness Event Planning & Promotion AssignmentObjective: Plan and promote a community wellness event related to a topic that you are interested Topic: Diabetes: Controlling Blood Sugar Levels
Theory of the term structure of interest rates : Why long-term financing is usually more expensive than short-term financing based on the theory of the term structure of interest rates?
What is an adventurous novel for me to read : What is an adventurous novel for me to read that includes powerful character development in modern society?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Define a class named payment that contains an instance

Define a class named Payment that contains an instance variable of type double that stores the amount of the payment and appropriate accessor and mutator methods.

  Write a scanf statement to read in one number (int

1) Write a scanf statement to read in one number (int), and another statement to print out that number.

  Write a c++ program which performs hexadecimal operands

Write a c++ program which performs +, -, *, / and $ on hexadecimal operands. The maximum length of any operand or a solution is 40 digits. The input will be in the following format

  Implementing the tictac-toe game

A software company that develops games has just hired you! Before working on the next version of Medieval Menace they have given you the task of implementing the tictac-toe game in C++

  Create a program that counts the number of numbers

you need to create a program that counts the number of numbers between 150 and 200 - Can you write this program in c language? You need to implement a function that counts the numbers.

  Write an application that reads the user''s weight

Write an application (BMICalc) that reads the user's weight in poinds and height in inches, then calculates the Body Mass Index.

  Perimeter of a trapezoid

Write a function in c that will return the perimeter of a trapezoid

  Provide a class diagram for every user authored class

Examine the sample code you have been provided with. This code is for a simple Car Hire management system. It contains a number of classes.

  Find the area of the circle

What is the ratio of the areas of the inscribed circle to that of the unit square -

  Write a declaration for s structure named car

Write a declaration for s structure named cars. The fields in the record should include make, model, year and cost. Include a constructor to initialize the value in the structure.

  Why does the neverwet spray protect it from water

As is know, acetone is a polar molecule like water, so isn't it suppose to mix? So my question is: why does the Neverwet spray protect it from water but not from oils and detergents?

  How do you make a row with different string names

How do you make a row with different string names and put a certain amount of space between each one?

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