home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0963.lha
/
SIOD
/
scm
/
merge-sort.scm
< prev
next >
Wrap
Text File
|
1993-05-07
|
397b
|
11 lines
(define (merge x y test)
(cond ((null? x) y)
((null? y) x)
((test (car x) (car y)) (cons (car x) (merge (cdr x) y test)))
(else (cons (car y) (merge x (cdr y) test)))))
(define (merge-sort x test)
(cond ((null? (cdr x)) x)
(else (merge (list (car x) (cadr x))
(merge-sort (cddr x) test) test))))