The Lambda Lab
/
projects
/
sam.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
P2P chat works.
[sam.git]
/
fifo.scm
diff --git
a/fifo.scm
b/fifo.scm
index
ab5eda0
..
14b24f1
100644
(file)
--- a/
fifo.scm
+++ b/
fifo.scm
@@
-2,6
+2,7
@@
(make-fifo
fifo-push
fifo-pop
(make-fifo
fifo-push
fifo-pop
+ fifo-empty?
fifo->list)
(import scheme
fifo->list)
(import scheme
@@
-38,6
+39,7
@@
(set! head '())
(set-cell-next! tail '()))
(cell-val old-tail)))
(set! head '())
(set-cell-next! tail '()))
(cell-val old-tail)))
+ ((empty?) (null? head))
((->list)
(let loop ((this-cell head))
(if (null? this-cell)
((->list)
(let loop ((this-cell head))
(if (null? this-cell)
@@
-51,5
+53,8
@@
(define (fifo-pop fifo)
(fifo 'pop))
(define (fifo-pop fifo)
(fifo 'pop))
+ (define (fifo-empty? fifo)
+ (fifo 'empty?))
+
(define (fifo->list fifo)
(fifo '->list)))
(define (fifo->list fifo)
(fifo '->list)))