Code Review
Compare your solutions
#| BEGIN (Write your solution here) |#
(define (element-of-set? x set)
(cond ((null? set) #f)
((= x (car set)) #t)
((< x (car set)) #f)
(else (element-of-set? x (cdr set)))))
(define (adjoin-set x set)
(cond ((null? set) (list x))
((< x (car set)) (cons x set))
((> x (car set)) (cons (car set) (adjoin-set x (cdr set))))
((= x (car set)) set)
((null? (cdr set)) (append set (list x)))
)
)
#| END |#
#| BEGIN (Write your solution here) |#
(define (element-of-set? x set)
(cond ((null? set) #f)
((= x (car set)) #t)
((< x (car set)) #f)
(else (element-of-set? x (cdr set)))))
(define (adjoin-set x set)
(cond ((null? set) (list x))
((< x (car set)) (cons x set))
((> x (car set)) (cons (car set) (adjoin-set x (cdr set))))
((= x (car set)) set)
)
)
#| END |#
#| BEGIN (Write your solution here) |#
(define (element-of-set? x set)
(cond ((null? set) #f)
((= x (car set)) #t)
((< x (car set)) #f)
(else (element-of-set? x (cdr set)))))
(define (adjoin-set x set)
(cond ((null? set) (list x))
((< x (car set)) (cons x set))
((> x (car set)) (cons (car set) (adjoin-set x (cdr set))))
((= x (car set)) set)
((null? (cdr set)) (append set (list x)))
)
)
#| END |#
#| BEGIN (Write your solution here) |#
(define (element-of-set? x set)
(cond ((null? set) #f)
((= x (car set)) #t)
((< x (car set)) #f)
(else (element-of-set? x (cdr set)))))
(define (adjoin-set x set)
(cond ((null? set) (list x))
((< x (car set)) (cons x set))
((> x (car set)) (cons (car set) (adjoin-set x (cdr set))))
((= x (car set)) set)
)
)
#| END |#