Reputation: 323
(define (all-different? L)
(if
(null? L)
#t
(
if(
(member (car L) (cdr L))
#f
(
(all-different? (cdr L))
))
)))
Upvotes: 0
Views: 21
Reputation: 235984
There are a couple of misplaced brackets, and the indentation is... inexistent. Try this, and notice the standard way to indent Scheme code and the places where we usually open and close the brackets - this will help you a lot to find bugs:
(define (all-different? L)
(if (null? L)
#t
(if (member (car L) (cdr L))
#f
(all-different? (cdr L)))))
Remember, in Scheme a pair of ()
brackets means: "apply this procedure with parameters". So you have to be very careful, don't go surrounding everything with ()
.
Upvotes: 2