Create a procedure that returns the last n items in the


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.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a procedure that returns the last n items in the
Reference No:- TGS01174748

Now Priced at $60 (50% Discount)

Recommended (96%)

Rated (4.8/5)

A

Anonymous user

4/18/2016 1:51:15 AM

There few questions that is need to describe of process 1. Create a procedure said (combine-four lst1lst2 lst3 lst4) that combines 4 lists into one list, in order of the given input lists. 2. Create a process that returns the last n items in the list lst. 3.1 Utilize a named procedure called (last-n lst n) to implement task. 3.2 Use an unnamed process ((lambda (lst n) (. . .) '(1 6 3 4 5) 2) to implement task, where '(1 6 3 4 5) 2 are the arguments. The unnamed process must provide '(4 5) 3. Generate 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. Make a procedure said (shuffle lst1 lst2) that returns a shuffle of 2 lists. Shuffle the lists via alternating elements between the 2 lists. You can suppose that both lists have the same length.