Question: 1. Write a simple function that calculates the sum of a list of integers. e.g. (sum '(5 4 6)) returns 15. Implement a non-tail-recursive solution

1. Write a simple function that calculates the sum of a list of integers. e.g. (sum '(5 4 6)) returns 15. Implement a non-tail-recursive solution and a tail-recursive solution. 2.Write a Scheme max function that finds the largest number. The input should be a list of integers. The logic as is discussed as follows.

boolean max(lst){ if (lst has only one element){ return the one element in lst } else if (car(lst) > max(cdr(lst))) { return car(lst) } else { return max(cdr(lst)) } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!