Question: We need a function guess in Scheme that has the following behaviour: > ( guess ' ( 1 2 3 4 ) ' ( 1

We need a function guess in Scheme that has the following behaviour:>(guess '(1234)'(12))(12)>(guess '(1234)'(1234567))(1234)>(guess '(a b c d)'(1234))()One of the following definitions allows such behaviour. This definition is:We need a function guess in Scheme that has the following behaviour:>(guess '(1234)'(12))(12)>(guess '(1234)'(1234567))(1234)>(guess '(a b c d)'(1234))()One of the following definitions allows such behaviour. This definition is:(define (guess l1 l2)(cond ((null? l1)())((null? l2)())((equal?(car l1)(car l2))(cons (guess (car l1)(car l2))(guess (cdr l1)(cdr l2))))(else ())))1.(define (guess l1 l2)(cond ((null? l1)())((null? l2)())((equal?(car l1)(car l2))(append (car l1)(guess (cdr l1)(cdr l2))))(else ())))2.(define (guess l1 l2)(cond ((null? l1)())((null? l2)())((equal?(car l1)(car l2))(cons (car l1)(guess (cdr l1)(cdr l2))))(else ())))3.(define (guess l1 l2)(cond ((null? l1)())((null? l2)())((equal?(car l1)(car l2))(append (guess (car l1)(car l2))(guess (cdr l1)(cdr l2))))(else ())))

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!