home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0963.lha
/
SIOD
/
scm
/
bubblesort.scm
< prev
next >
Wrap
Text File
|
1993-02-22
|
630b
|
16 lines
(define (bubble-sort l test)
(let ((changes #t)
(l1 l)
(tmp nil))
(while changes
(set! changes #f)
(while (not (null? (cdr l1)))
(if (test (car l1) (cadr l1))
(begin (set! tmp (car l1))
(set-car! l1 (cadr l1))
(set-car! (cdr l1) tmp)
(set! changes #t)))
(gc)
(set! l1 (cdr l1)))
(set! l1 l))))