4
;; Merge two sorted list into a sorted list
5
(define (list-merge a b)
10
[(zero? (length b)) a]
11
[else (if (< (car a) (car b))
12
(cons (car a) (list-merge (cdr a) b))
13
(cons (car b) (list-merge a (cdr b))))]))
15
(list-merge '(1 10 20 30) '(2 9 15 25 42 56))
7
;; Merge two sorted list into a sorted list
8
(define (list-merge a b)
12
[(zero? (length a)) b]
13
[(zero? (length b)) a]
14
[else (if (< (car a) (car b))
15
(cons (car a) (list-merge (cdr a) b))
16
(cons (car b) (list-merge a (cdr b))))]))
18
(check-equal? (list-merge '(1 10 20 30) '(2 9 15 25 42 56))
19
'(1 2 9 10 15 20 25 30 42 56))
b'\\ No newline at end of file'