X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=sam.git;a=blobdiff_plain;f=fifo.scm;h=ca5634fac28bd1e07ec63d750a229783c6aab4ec;hp=ab5eda05a5e6e22c945ac83d6f0241746e07c966;hb=HEAD;hpb=bf8a20a40dd9e5d963498a0fe43ef5fea52d07c6 diff --git a/fifo.scm b/fifo.scm index ab5eda0..ca5634f 100644 --- a/fifo.scm +++ b/fifo.scm @@ -1,7 +1,11 @@ +;;; A basic FIFO queue module. +;;; + (module fifo (make-fifo fifo-push fifo-pop + fifo-empty? fifo->list) (import scheme @@ -38,6 +42,7 @@ (set! head '()) (set-cell-next! tail '())) (cell-val old-tail))) + ((empty?) (null? head)) ((->list) (let loop ((this-cell head)) (if (null? this-cell) @@ -51,5 +56,8 @@ (define (fifo-pop fifo) (fifo 'pop)) + (define (fifo-empty? fifo) + (fifo 'empty?)) + (define (fifo->list fifo) (fifo '->list)))