# Programming a few procedures in scheme

Programming a few procedures in scheme

Using Scheme:
1.    Create a procedure called (combine-four lst1 lst2 lst3 lst4) that combines 4 lists into one list, in order of the given input lists.
Test case: (combine-four ‘(1 2) ‘(3 4) ‘(5 6) ‘(7 8 9)) should give ‘(1 2 3 4 5 6 7 8 9)

2.    Create a procedure that returns the last n items in the list lst.
3.1 Use a named procedure called (last-n lst n) to implement task.
Test case: (last-n ‘(1 6 3 4 5) 2) should give ‘(4 5)
3.2 Use an unnamed procedure ((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-n lst) 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.
Test case with read-in input 3: (first-n ‘(1 5 3 4 5)) should give ‘(1 5 3)

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 assume that both lists have the same length.
Test case: (shuffle ‘(1 2 3) ‘(a b c)) should give ‘(1 a 2 b 3 c).

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.
Test case: (shufflePairs  ‘(1 2 3) ‘(a b c)) is ‘((1 . a) (2 . b) (3 . c)).

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 (addNonEmptyList lst) that returns the sum of square values of all elements in the lst. If lst is empty, (addNonEmptyList lst) 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.
Test cases:

They should return:
“empty list”
0
14
30

PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET A GOOD DISCOUNT

Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

### Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors: