Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions