Write a function using scheme language, that takes in a list of values as input and returns true if list contains two equal values otherwise return false. For example: If the list XXXXXXXXXXshould...


Write a function using scheme language, that takes in a list of values as input and returns true if list contains two equal values otherwise return false.
For example:
If the list (1 5 1 5) should print #t
If the list (4 2 3 6) should print #f


Note: You can not use any built-in function and use pure scheme language also use recursion to acheive this. The soultion should be runnable in Dr. Racket IDE.


Please don't give solution in any other language it should be Scheme language only.



My solution which works only half if you please enhance and correct it:


(define duplicateCheck (lambda (testList)
    (cond ((null? testList) #f)
        ( (eq? (car testList) (car (cdr testList) ))#t)
        (not(eq? (car testList) (car (cdr testList) ))#f)
        (else (duplicateCheck (cdr testList))))
))



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here