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

Below is a question Im having issues with what I have so far will be after the ?

ID: 3663811 • Letter: B

Question

Below is a question Im having issues with what I have so far will be after the ?

Dont know y but it doesnt work...

17.5  Here's a procedure that takes two numbers as arguments and returns whichever number is larger:

Use max2 to implement max, a procedure that takes one or more numeric arguments and returns the largest of them.

; Here's a procedure that takes two numbers as arguments and returns whichever
; number is larger:
;
; (define (max2 a b)
; (if (> b a) b a))
;
; Use max2 to implement max, a procedure that takes one or more numeric arguments
; and returns the largest of them.

(define (max2 a b)
(if (> b a) b a))

(define (maxxx n . the-rest)
(if (null? the-rest)
n
(apply maxxx
(cons (max2 n (car the-rest))
(cdr the-rest)))))

Explanation / Answer

the problem is with the parenthesis kindly make the following changes and execute it:

(define (max2 a b)
(if ((> b a)) b a))

(define (maxxx n . the-rest)
(if (null? the-rest))
n
(apply maxxx
(cons (max2 n (car the-rest))
(cdr the-rest)))

:

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