Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (contains l x)
- (cond
- ((null? l) #f)
- ((eq? (car l) x) #t)
- (else (contains (cdr l) x))))
- (define (length lis)
- (cond ((null? lis)
- 0)
- (else
- (+ 1 (length (cdr lis))))))
- (define (reverse1 l)
- (if (null? l)
- nil
- (append (reverse1 (cdr l)) (list (car l)))
- )
- )
- (define (modulo a b)
- (if (< a b) a (modulo (- a b) b))
- )
- (define (get l)
- (if
- (= (modulo (length l) 2) 0)
- (car l)
- (car (reverse l)))
- )
- (get '(5 3 7))
- (contains '(3 6 8 1) 8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement