The assignment is to define a function that accepts a single list as a parameter and outputs the maximum value of the list. I feel like my nesting "ifs" and "lets" are very excessive and the function is terminating prematurely without printing an answer. I've looked for an example of using let properly with recursion but have come up empty, the debugging features in DrRacket aren't very useful for tracing through recursive call.
Any help is appreciated, thanks.
(define max
(lambda (x)
(let ((y (car x)))
(if (null? (cdr x))
y
(let ((m (max(cdr x))))
(if (> m y)
m
y)
)))))