Question: Using Scheme!!!! 1. Create a procedure called (sumEvenlst), where lst is a list of numbers. The procedure should return the sum of all evennumbers intheinputlist.
Using Scheme!!!!
1. Create a procedure called (sumEvenlst), where lst is a list of numbers. The procedure should return the sum of all evennumbers intheinputlist. When the list is empty, the result should be 0. [10 points total]
1.1)Use a namedprocedure called (sumEvenlst)to implement this task.[5points] Test case: (sumEven'(1 3 -4 5 6 -7)) 2
1.2)Use an unnamed procedure to directly implement this task. It will be something like:((lambda (lst) (add your code here)'(1 3 -4 5 6 -7)) where the list '(1 3 -4 5 6 -7)is the argument. [5points]
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 '(4 3 7 1 2 9) '(1 2) should give '(4 3 7 1 2 9 1 2) [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'(4 3 7 1 2 9) '(1 2) should give '(1 2 4 3 7 1 2 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 ('4 3 7 1 2 9)) should give '(4 3 7).[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-front 3 ('4 3 7 1 2 9)) should give '(1 2 9).[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 '(1 2) '(a b)) is '(1 a 2 b). [20pointstotal; 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 appropriateto create and bind names in a local scope.(Hint: one of the list operationsmight be really easy to do...)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
