I need to write a Scheme function that checks a list for duplicate entries. I think I've got the workflow down on paper, I just need help getting it from the paper into code.
First I need to check if it's an empty list. So I've got...
(define (checkDupe mylist)
(if (null? mylist)
()
(checkDupeB mylist)
)
)
Then I have this sort of "double recursion" where I check the first number against the rest of the list, then the second number against the rest of the list, and so on, and when it finds a match it spits out a #t
, if it hits the end and doesn't find a match, the result of the function is #f
. The problem is I just can't wrap my head around this recursion stuff. This is a homework question, but I'm geniunely interested in learning this stuff though.
Can someone throw some code at me and help me work through this?