Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Functional Programming using scheme. Please answer using Dr Racket. Create a scheme function that takes two lists and returns a single list. For example, add

Functional Programming using scheme. Please answer using Dr Racket.

Create a scheme function 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 "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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Find the number of each type of flower in Exercise 10.11.

Answered: 1 week ago

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago