8.5 The following procedure computes the maximum value in a list of numbers: max( [X], X). max(...

Question:

8.5 The following procedure computes the maximum value in a list of numbers: max( [X], X). max( [X | Rest], Max) :- max( Rest, MaxRest), ( MaxRest >= X, !, Max = MaxRest ; Max = X). Transform this into a tail-recursive procedure. Hint: Introduce accumulator argument MaxSoFar.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: