Question: PLEAs?E HELP WITH THE MAP FUNCTION, Using scheme. I have d?one the firs?t part. Thank you Write a function nameds double-list-elements that takes list as
PLEAs?E HELP WITH THE MAP FUNCTION, Using scheme. I have d?one the firs?t part. Thank you
Write a function nameds double-list-elements that takes list as argument and returns a list that has a list with all elements doubled value. Write a function double-list-elements-one that uses map function that takes the function and list as two inputs and produces the same output as the previous function Write your own version of map function do not use the predefined one. (20 points)
Sample runs: (double-list-elements (1 2 3)) should return (2 4 6)
(double-list-elements-one (4 5)) should return (8 10)
(define (double-list-elements pairNums) (if (null? pairNums) null (cons (* 2 (car pairNums)) (double-list-elements (rest pairNums)) )))
(define (evenlist numberlist) (cond ((null? numberlist) '()) ((not (numberlist)) (if (even? numberlist) (list numberlist) '())) (else (append (evenlist (car numberlist)) (evenlist (cdr numberlist))))))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
