3

Your submission must include 2 files:
(a) The source code in R5RS,
(b) 1–2-page comparison of Java and Scheme. Based on the code from HW2 and HW3,
write a short comparison of Java and Scheme using the language evaluation criteria from Chapter 1. How do they compare in terms readability, simplicity, orthogonality, and writability?
Pack all your files in a zip file.
Write a function sum in Scheme that takes a single parameter, a list of positive integers (duplicates are possible, zero is not considered a positive integer). The function sum returns #t if the list includes two integers such that their sum equals a third integer from the list. Otherwise, it returns #f. The list is flat, i.e., it does not contain sublists. Assume that the list is not empty and it contains at least three integers.
Note that the function must be called sum and that it takes a single parameter, a list. Functions with other names or other parameters will not be graded.
(sum ‘(1 2 3)) returns #t
(sum ‘(1510307115021))returns#t(sum ‘(2071104215361052))returns#t
(sum ‘(55 99 21 100 37 37 101 77 57 102 10)) returns #f (sum ‘(15 36 16 40 82 65)) returns #f The whole solution must be packed in one recursive function sum which must look as follows: (define sum (lambda (list)
In other words, you have to define a single COND statement. Nested COND statements are not allowed.
Inside COND, you can use ONLY the following constructs:
– car and cdr and their derivatives, cadr, cddr, etc. – cons
– sum – list
– parentheses
You cannot use a construct if it is not listed above. In other words, your code must define and use only one function, sum, which must be defined using the constructs listed above. The use of built- in functions is not allowed. You cannot define any other functions but sum.
Programs that do not follow the requirements, or are not written in R5RS, or break during execution will receive zero points.
CS Help, Email: tutorcs@163.com