Question: Functional Programming using scheme. Use Scheme and then use (Dr. Racket to test the cases) if possible. Create a function program using scheme language that
Functional Programming using scheme.
Use Scheme and then use (Dr. Racket to test the cases) if possible.
Create a function program using scheme language that takes two lists and returns a single list. For example, add the two input lists together to create one output list. Below is the test cases that should work when you type them in.
(display (vecadd '() '())) (newline) ; () (display (vecadd '(1) '(2))) (newline) ; (3) (display (vecadd '(1 2 3) '(4 5 6))) (newline) ; (5 7 9) (display (vecadd '(1 . 3) '(4 . 6))) (newline) ; (5 . 9)
Create a second function using scheme "vecfn" that allows one to pass the function to perform on the input lists as the first argument. Below are the test cases that should work when you type them in.
(display (vecfn - '(1 2 3) '(4 5 6))) (newline) (display (vecfn + '(4) (list (sqrt -1)))) (newline) (display (vecfn / '(1 2 3) '(1 4 5))) (newline)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
