Examples:
(union '(a b c) '(b d a)) = '(b d a c)
(diff '(a b c) '(b d a)) = '(d c)
(sortedUnion
'(a b e) '(b c d)) = '(a b c d e)
(sortedDiff '(a b e) '(b c d)) = '(a e)
(define (findFirst x y) (if (pair? x) (if (y (car x)) (car x) (findFirst (cdr x) y))))
(define (gt5 x) (> x 5))
(define (findAll x y) (if (null? x) '() (if (y (car x)) (cons (car x) (findAll (cdr x) y)) (findAll (cdr x) y))))
(define (mycompose x y) (lambda (z) (x (y z))))
(define (dfs List Action) (if (pair? List) (begin (dfs (car List) Action) (dfs (cdr List) Action)) (Action List)))
(define (findFirst x y) (if (pair? x) (if (y (car x)) (car x) (findFirst (cdr x) y))))
(define (gt5 x) (> x
5))
(define (findAll x y) (if (null? x) '() (if (y (car x)) (cons (car
x) (findAll (cdr x) y)) (findAll (cdr x) y))))
(define (mycompose x y) (lambda (z) (x (y z))))
(define (dfs List Action) (if (pair? List) (begin (dfs (car List) Action) (dfs (cdr List) Action)) (Action List)))
(define (length List)
(if (pair? List) (+ 1 (length (cdr
List))) 0))
(define (pairs List) (if
(pair? List) (if (pair? (cdr
List)) (cons (list (car List) (cadr
List)) (pairs (cdr List))) '()) '()))
(define (myequal L1 L2) (if (and (pair? L1) (pair?
L2))
(and (myequal (car L1) (car L2)) (myequal (cdr L1) (cdr L2)))
(eq? L1 L2)))
(define (member x List)
(if (pair? List)
(if (myequal (car List) x) #t
(member x (cdr List)))
(eq? x List)))
(define (mynumber x Tree) (if (pair? Tree)
(if (myequal x (car Tree)) (+ 1 (mynumber x (cdr Tree)))
(+ (mynumber x (car Tree)) (mynumber x (cdr
Tree))))
(if
(myequal x Tree) 1 0)))
(define (mymult x y) (if (> x 0) (+ y (mymult
(- x 1) y)) 0))
(define (mysublist x y) (if (eqfront x y)
#t
(if
(>= (length x) (length y)) #f
(eqfront x (cdr
y)))))
(define (eqfront x y) (if (and (pair? x) (pair? y)) (and
(myequal (car x) (car y)) (eqfront (cdr x) (cdr y)))
(null? x)))