RACKET Scheme prog

Closed Posted 2 years ago Paid on delivery
Closed Paid on delivery

list has two equal elements recursively in scheme

These are the elements initially pointed by REF and REST. If they are the same, we return #t. If not, we can make a recursive call on the list from which we have removed the second element (in Java, we change REST to [login to view URL] and by doing so we skip the second element pointed by REST). If the recursive call returns #t, the whole function returns #t. This recursive call will recursively compare the first element of the list with all subsequent elements by removing the elements that are not equal to the first element until the end of the list is reached. Otherwise (if the first recursive call fails), we need to make one more recursive call in which we delete the first element of the list (in Java, we change REF to [login to view URL], therefore skipping the first element). Obviously, the first element does not have a match if the first recursive call failed.

Examples

(two ‘(7 7)) returns #t

(two ‘(5 3 3 4)) returns #t

(two ‘(11 3 5 11)) returns #t

(two ‘(1 2 3 4 5 6 10)) returns #f

(two ‘(24 14 11 4 6)) returns #f

The whole solution must be packed in one recursive function two which must look as follows: (define two (lambda (list)

(cond

...

)))

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: - null?

- car

- cdr

- cons

- else

- =

- #t

- #f

- two

- list

Java

Project ID: #32192739

About the project

4 proposals Remote project Active 2 years ago

4 freelancers are bidding on average $25 for this job

koustav2006

HI..i am familiar and good at Racket/Scheme/Lisp programming and can help you write functions for completing a puzzle or any problem using DrRacket.

$10 USD in 2 days
(256 Reviews)
6.8
mlobovic

Hi Nice to meet you. I have read your job carefully and I'm very confident about your job. As a talented application developer, I have much experience with JAVA for more than 10+ years. If you give me a chance to chat More

$30 USD in 1 day
(14 Reviews)
4.6
uvtxyz1991

- previous experience in such topics ; - eager to discuss a lot in this chat stream; - degree stats -maths ;

$30 USD in 1 day
(2 Reviews)
1.6