Question: write this program in Racket language. Assigned:Thursday, September 28, 2017 (started in class) Due: Tuesday, October 3, 2017, code and output, clearly labeled, turned in
write this program in Racket language.


Assigned:Thursday, September 28, 2017 (started in class) Due: Tuesday, October 3, 2017, code and output, clearly labeled, turned in on Blackboard. Remember: Function calls must be used in Racket, as the language does not provide a loop construct. Recursive function calls are used to accomplish many tasks. Here is an example problem and a recursive solution in Racket (discussed in class earlier). Assume you need to write a function call "sumlist" which is passed a list of numbers and which returns the sum. Here is the code that will accomplish this task. (define sumlist (lambda (lst) (if (empty? lst) 0 (+ (car lst) (sumlist (cdr Is)) [You may want to run the code yourself.] This function is very typical. "Define" is used to associate the symbol "sumlist" with the lambda expression which defines the formal parameter (lst) and the function body. The function body is an "if" function which returns 0 if the list is empty (base case return value) and a recursive value otherwise Two functions were developed in class: 1. Function 1 Write a function called make-seq-list which accepts two parameters (x y) and returns the list containing x, x+1, x+2,..y. You can assume that x and y are integers and x = x y) (if (= x y) (cons y empty ) #f) (cons x (make-seq-list (+ x 1) y )))) (define (make-whole-list x) (make-seq-list 1 x)) Results > (make-seq-list 1 4) (1 23 4) > (make-whole-list 8) (1 23456 7 8)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
