Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Practice with Scheme Dr. Scheme can be downloaded for FREE at http://plt- scheme

ID: 3753504 • Letter: P

Question

Practice with Scheme Dr. Scheme can be downloaded for FREE at http://plt- scheme.org/ 1. (1 point) Write a function in Scheme to return -1, 0, +1 depending on two parameters a and b: a b return +1 a- b return 0 2. (3 points) Write a recursive function in Scheme, called "get-element" which takes two parameters, an index and a list. The function returns the element at the given index position in the list or #fif element is not contained. Indices start at 1 and go to the length of the list 3. (1 point) Question: How would you change the function so it returns the whole list if the element is not contained?

Explanation / Answer

1. function to return -1,0,1 depending on parameters a and b

(defne A

(lambda a b)

(if (< a b)

-1

(if (< a b)

1

(if (= a b)

0

)

)

)

)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote