Question: 1 . Create a procedure called ( sumEven lst ) , where lst is a list of numbers. The procedure should return the sum of

1. Create a procedure called (sumEven lst), where lst is a list of numbers. The procedure should
return the sum of all even numbers in the input list. When the list is empty, the result should be
0.[10 points total]
1.1) Use a named procedure called (sumEven lst) to implement this task. [5 points]
Test case: (sumEven '(13-456-7))2
1.2) Use an unnamed procedure to directly implement this task. It will be something like:
((lambda (lst)(add your code here)'(13-456-7)) where the list '(13-456-7) is the argument.
[5 points]
2. Create a procedure called (list-push-back lst new-list) that adds the elements from new-list to
the back of lst. Sample output: (list-push-back '(437129)'(12) should give '(43712912)[5
points]
3. Create a procedure called (list-push-front lst new-list) that adds the elements from new-list
to the front of lst. Sample output: (list-push-front '(437129)'(12) should give '(1243712
9)[5 points]
4. Create a procedure called (list-draw-front n lst) that returns the first n items in the lst.
Sample output: (list-draw-front 3(437129)) should give '(437).[5 points]
5. Create a procedure called (list-draw-back n lst) that returns the last n items in the lst. Sample
output: (list-draw-back 3(437129)) should give '(129). Do not use list-tail. [5 points]
6. Create a procedure called (list-shuffle lst1 lst2) which returns the perfect shuffle of two lists.
The perfect shuffle of two lists is a new list created by alternately picking elements from one of
the two input lists. Since it is a perfect shuffle, assume both lists have the same length. Add
comments to describe how your algorithm for generating the perfect shuffle works. Sample
output: (list-shuffle '(12)'(a b)) is '(1 a 2 b).[20 points total; 15 points for implementation, 5 for
comments.]
There is no explicit requirement to use let-form in these problems. It is something you should
use as it is appropriate to create and bind names in a local scope.
(Hint: one of the list operations might be really easy to do...)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!