source: project/release/5/mailbox/trunk/inline-queue.scm @ 39744

Last change on this file since 39744 was 39744, checked in by Kon Lovett, 7 weeks ago

remove "undefined" operations

File size: 19.6 KB
Line 
1;;;; inline-queue.scm  -*- Scheme -*-
2;;;; Kon Lovett, Mar '21
3;;;; Kon Lovett, Jun '10
4
5;; Issues
6;;
7;; - Uses (chicken fixnum), (srfi 1), & record-variants
8
9;; Queue Unlimited
10
11;the identifier needs to be defined by somebody
12(define queue-unlimited 'queue-unlimited)
13(define-record-type-variant queue-unlimited (unsafe unchecked inline)
14  (make-queue-unlimited ln hd tl)
15  (queue-unlimited?)
16  (ln queue-unlimited-count queue-unlimited-count-set!)
17  (hd queue-unlimited-first-pair queue-unlimited-first-pair-set!)
18  (tl queue-unlimited-last-pair queue-unlimited-last-pair-set!) )
19
20(define (make-empty-queue-unlimited)
21  (make-queue-unlimited 0 '() '()) )
22
23(define (queue-unlimited-limit q) most-positive-fixnum)
24
25(define (queue-unlimited-room q) (queue-unlimited-limit q))
26
27(define (queue-unlimited-count-add! q n)
28  (queue-unlimited-count-set! q (fx+ (queue-unlimited-count q) n)) )
29
30(define (queue-unlimited-count-sub! q n)
31  (queue-unlimited-count-set! q (fx- (queue-unlimited-count q) n)) )
32
33(define (queue-unlimited-empty? q #!optional (n 0))
34  (fx<= (fx- (queue-unlimited-count q) n) 0) )
35
36(define (queue-unlimited-full? q #!optional (n 0))
37  #f )
38
39(define (queue-unlimited-extract-pair! q targ-pair)
40  ;scan queue list until we find the item to remove
41  (let scanning ((this-pair (queue-unlimited-first-pair q)) (prev-pair '()))
42    ;keep scanning until found
43    (cond
44      ;should not happen but no infinite loops
45      ((null? this-pair)
46        ;note that the pair to extract is in fact gone so ...
47        (error "cannot find queue pair to extract; simultaneous operations?"))
48      ;found?
49      ((eq? this-pair targ-pair)
50        ;so cut out the pair
51        (let ((next-pair (cdr this-pair)))
52          ;at the head of the list, or in the body?
53          (if (null? prev-pair)
54            (queue-unlimited-first-pair-set! q next-pair)
55            (set-cdr! prev-pair next-pair) )
56          ;when the cut pair is the last item update the last pair ref.
57          (when (eq? this-pair (queue-unlimited-last-pair q))
58            (queue-unlimited-last-pair-set! q prev-pair) )
59          (queue-unlimited-count-sub! q 1) ) )
60      ;not found
61      (else
62        (scanning (cdr this-pair) this-pair) ) ) ) )
63
64(define (queue-unlimited-add! q v)
65  (let ((new-pair (cons v '())))
66    (if (null? (queue-unlimited-first-pair q))
67      (queue-unlimited-first-pair-set! q new-pair)
68      (set-cdr! (queue-unlimited-last-pair q) new-pair) )
69    (queue-unlimited-last-pair-set! q new-pair)
70    (queue-unlimited-count-add! q 1)) )
71
72(define (queue-unlimited-remove! q)
73  (let* ((first-pair (queue-unlimited-first-pair q))
74         (next-pair (cdr first-pair)))
75    (queue-unlimited-first-pair-set! q next-pair)
76    (when (null? next-pair) (queue-unlimited-last-pair-set! q '()))
77    (queue-unlimited-count-sub! q 1)
78    (car first-pair) ) )
79
80(define (queue-unlimited-push-back! q v)
81  (let ((newlist (cons v (queue-unlimited-first-pair q))))
82    (queue-unlimited-first-pair-set! q newlist)
83    (when (null? (queue-unlimited-last-pair q))
84      (queue-unlimited-last-pair-set! q newlist) )
85    (queue-unlimited-count-add! q 1) ) )
86
87(define (queue-unlimited-push-back-list! q ls)
88  (let ((newlist (append! (list-copy ls) (queue-unlimited-first-pair q))))
89    (queue-unlimited-first-pair-set! q newlist)
90    (if (null? newlist)
91      (queue-unlimited-last-pair-set! q '())
92      (queue-unlimited-last-pair-set! q (last-pair newlist) ) )
93    (queue-unlimited-count-add! q (length ls)) ) )
94
95(define (make-queue-unlimited-cursor) (cons '() #f))
96(define (queue-unlimited-cursor? c) (pair? c))
97(define (queue-unlimited-cursor-next-pair c) (car c))
98(define (queue-unlimited-cursor-next-pair-set! c v) (set-car! c v))
99(define (queue-unlimited-cursor-prev-pair c) (cdr c))
100(define (queue-unlimited-cursor-prev-pair-set! c v) (set-cdr! c v))
101
102(define (queue-unlimited-cursor-winding? q c)
103  (->boolean (queue-unlimited-cursor-prev-pair c)) )
104
105(define (queue-unlimited-cursor-unwound? q c)
106  (null? (queue-unlimited-cursor-next-pair c)) )
107
108(define (queue-unlimited-cursor-start! q c)
109  ;(queue-unlimited-cursor-prev-pair-set! c #f)
110  (queue-unlimited-cursor-next-pair-set! c (queue-unlimited-first-pair q)) )
111
112;#!eof | *
113(define (queue-unlimited-cursor-next! q c)
114  (let ((curr-pair (queue-unlimited-cursor-next-pair c)))
115    ;anything next?
116    (if (null? curr-pair)
117      #!eof
118      ;then peek into the queue for the next item
119      (let ((item (car curr-pair)))
120        (queue-unlimited-cursor-prev-pair-set! c curr-pair)
121        (queue-unlimited-cursor-next-pair-set! c (cdr curr-pair))
122        item ) ) ) )
123
124(define (queue-unlimited-cursor-continue! q c)
125  ;NOTE assumes 1 next item, so prev-pair is still correct
126  (queue-unlimited-cursor-next-pair-set! c (queue-unlimited-last-pair q)) )
127
128(define (queue-unlimited-cursor-rewind! q c)
129  (queue-unlimited-cursor-prev-pair-set! c #f)
130  (queue-unlimited-cursor-next-pair-set! c '()) )
131
132(define (queue-unlimited-cursor-extract! q c)
133  ;unless 'mailbox-cursor-next' has been called don't remove
134  (and-let* ((prev-pair (queue-unlimited-cursor-prev-pair c)))
135    (queue-unlimited-extract-pair! q prev-pair) ) )
136
137(define (queue-unlimited-delete! q x)
138  (let ((c (make-queue-unlimited-cursor)))
139    (queue-unlimited-cursor-start! q c)
140    (let loop ()
141      (let ((y (queue-unlimited-cursor-next! q c)))
142        (cond
143          ((eof-object? y)
144            #f )
145          ((eq? x y)
146            (queue-unlimited-cursor-extract! q c)
147            #t )
148          (else
149            (loop) ) ) ) ) ) )
150
151(define (queue-unlimited->list q)
152  (let ((c (make-queue-unlimited-cursor)))
153    (queue-unlimited-cursor-start! q c)
154    (let loop ((ls '()))
155      (let ((y (queue-unlimited-cursor-next! q c)))
156        (cond
157          ((eof-object? y)
158            ls )
159          (else
160            (loop (cons y ls)) ) ) ) ) ) )
161
162;; Queue Limited
163
164;circular buffer: s <= e: s = e -> empty, |e - s| = n -> full, s < e -> some
165;
166; inc i: (i + 1)      mod n
167; dec i: (i + (n-1))  mod n
168
169;the identifier needs to be defined by somebody
170(define queue-limited 'queue-limited)
171(define-record-type-variant queue-limited (unsafe unchecked inline)
172  (make-queue-limited vc st ed)
173  (queue-limited?)
174  (vc queue-limited-vector)
175  (st queue-limited-start queue-limited-start-set!)
176  (ed queue-limited-end queue-limited-end-set!) )
177
178(define (make-empty-queue-limited lm)
179  ;limit of 2 is lower-bound otherwise always s = e!
180  ;limit + 1 so
181  (make-queue-limited (make-vector (fx+ (fxmax 2 lm) 1) (void)) 0 0) )
182
183(define (queue-limited-peek q i)    (vector-ref (queue-limited-vector q) i))
184(define (queue-limited-poke! q i v) (vector-set! (queue-limited-vector q) i v))
185
186(define (queue-limited-limit q)
187  (fx- (vector-length (queue-limited-vector q)) 1) )
188
189(define (queue-limited-index-inc q i)
190  (fxmod (fx+ i 1) (queue-limited-limit q)) )
191
192(define (queue-limited-index-dec q i)
193  (fxmod (fx+ i (fx- (queue-limited-limit q) 1)) (queue-limited-limit q)) )
194
195(define (queue-limited-start-inc! q)
196  (queue-limited-start-set! q (queue-limited-index-inc q (queue-limited-start q))) )
197
198(define (queue-limited-start-dec! q)
199  (queue-limited-start-set! q (queue-limited-index-dec q (queue-limited-start q))) )
200
201(define (queue-limited-end-inc! q)
202  (queue-limited-end-set! q (queue-limited-index-inc q (queue-limited-end q))) )
203
204(define (queue-limited-end-dec! q)
205  (queue-limited-end-set! q (queue-limited-index-dec q (queue-limited-end q))) )
206
207(define (queue-limited-count q)
208  (fxabs (fx- (queue-limited-end q) (queue-limited-start q))) )
209
210(define (queue-limited-empty? q #!optional (n 0))
211  (fx<= (fx- (queue-limited-count q) n) 0) )
212
213(define (queue-limited-full? q #!optional (n 0))
214  (fx>= (fx+ (queue-limited-count q) n) (queue-limited-limit q)) )
215
216(define (queue-limited-room q)
217  (fx- (queue-limited-limit q) (queue-limited-count q)) )
218
219(define (queue-limited-empty? q #!optional (n 0))
220  (fx<= (fx- (queue-limited-count q) n) 0) )
221
222(define (queue-limited-full? q #!optional (n 0))
223  (fx>= (fx+ (queue-limited-count q) n) (queue-limited-limit q)) )
224
225(define (queue-limited-add! q v)
226  (queue-limited-poke! q (queue-limited-end q) v)
227  (queue-limited-end-inc! q) )
228
229(define (queue-limited-remove! q)
230  (let ((v (queue-limited-peek q (queue-limited-start q))))
231    (queue-limited-start-inc! q)
232    v ) )
233
234(define (queue-limited-push-back! q v)
235  (queue-limited-start-dec! q)
236  (queue-limited-poke! q (queue-limited-start q) v) )
237
238(define (queue-limited-push-back-list! q ls)
239  ;assert enough room at the inn!
240  ;move "down" from start to start-1; kinda like extract below
241  (let loop ((i (queue-limited-start q)) (ls (reverse ls)))
242    (if (null? ls)
243      (queue-limited-start-set! q i)
244      (let ((i-1 (queue-limited-index-dec q i)))
245        (queue-limited-poke! q i-1 (car ls))
246        (loop i-1 (cdr ls)) ) ) ) )
247
248(define (make-queue-limited-cursor) (cons -1 (void)))
249(define (queue-limited-cursor? c) (pair? c))
250(define (queue-limited-cursor-index c) (car c))
251(define (queue-limited-cursor-index-set! c v) (set-car! c v))
252
253(define (queue-limited-cursor-winding? q c)
254  (fx<= 0 (queue-limited-cursor-index c)) )
255
256(define (queue-limited-cursor-unwound? q c)
257  (fx= (queue-limited-end q) (queue-limited-cursor-index c)) )
258
259(define (queue-limited-cursor-start! q c)
260  (queue-limited-cursor-index-set! c (queue-limited-start q)) )
261
262;#!eof | *
263(define (queue-limited-cursor-next! q c)
264  (cond
265    ((queue-limited-cursor-unwound? q c) #!eof)
266    (else
267      (let ((v (queue-limited-peek q (queue-limited-cursor-index c))))
268        (queue-limited-cursor-index-set! c
269          (queue-limited-index-inc q (queue-limited-cursor-index c)))
270        v ) ) ) )
271
272(define (queue-limited-cursor-continue! q c)
273  (queue-limited-cursor-index-set! c
274    (queue-limited-index-dec q (queue-limited-cursor-index c))) )
275
276(define (queue-limited-cursor-rewind! q c)
277  (queue-limited-cursor-index-set! c -1) )
278
279(define (queue-limited-cursor-extract! q c)
280  ;unless 'mailbox-cursor-next' has been called don't remove
281  (when (queue-limited-cursor-winding? q c)
282    ;move "up" from i-1 to i until i = start
283    (let loop ((i (queue-limited-index-dec q (queue-limited-cursor-index c))))
284      (let ((i-1 (queue-limited-index-dec q i)))
285        (queue-limited-poke! q i (queue-limited-peek q i-1))
286        (if (fx= (queue-limited-start q) i-1)
287          (queue-limited-start-set! q i)
288          (loop i-1) ) ) ) ) )
289
290(define (queue-limited-delete! q x)
291  (let ((c (make-queue-limited-cursor)))
292    (queue-limited-cursor-start! q c)
293    (let loop ()
294      (let ((y (queue-limited-cursor-next! q c)))
295        (cond
296          ((eof-object? y)
297            #f )
298          ((eq? x y)
299            (queue-limited-cursor-extract! q c)
300            #t )
301          (else
302            (loop) ) ) ) ) ) )
303
304(define (queue-limited->list q)
305  (let ((vc (queue-limited-vector q)) (st (queue-limited-start q)))
306    (let loop ((ed (queue-limited-count q)) (ls '()))
307      (if (fx= st ed)
308        ls
309        (let ((ed (queue-limited-index-dec q ed)))
310          (loop ed (cons (vector-ref vc ed) ls)) ) ) ) ) )
311
312;; Queue Unbuffered
313
314;the identifier needs to be defined by somebody
315(define queue-unbuffered 'queue-unbuffered)
316(define-record-type-variant queue-unbuffered (unsafe unchecked inline)
317  (make-queue-unbuffered vd vl)
318  (queue-unbuffered?)
319  (vd queue-unbuffered-maybe? queue-unbuffered-maybe-set!)
320  (vl queue-unbuffered-value queue-unbuffered-value-set!) )
321
322(define (make-empty-queue-unbuffered)
323  (make-queue-unbuffered #f (void)) )
324
325(define (queue-unbuffered-limit q) 1)
326
327(define (queue-unbuffered-count q)
328  (if (queue-unbuffered-maybe? q) 1 0) )
329
330(define (queue-unbuffered-empty? q #!optional (n 0))
331  (or (fx< 0 n)
332      (not (queue-unbuffered-maybe? q))) )
333
334(define (queue-unbuffered-full? q #!optional (n 0))
335  (or (fx< 0 n)
336      (queue-unbuffered-maybe? q)) )
337
338(define (queue-unbuffered-room q)
339  (if (queue-unbuffered-maybe? q) 0 1) )
340
341(define (queue-unbuffered-add! q v)
342  (queue-unbuffered-maybe-set! q #t)
343  (queue-unbuffered-value-set! q v) )
344
345(define (queue-unbuffered-remove! q)
346  (let ((v (queue-unbuffered-value q)))
347    (queue-unbuffered-maybe-set! q #f)
348    (queue-unbuffered-value-set! q (void))
349    v ) )
350
351(define (queue-unbuffered-push-back! q v)
352  (queue-unbuffered-add! q v) )
353
354(define (queue-unbuffered-push-back-list! q ls)
355  ;assert length ls = 1
356  (queue-unbuffered-add! q (car ls)) )
357
358(define (make-queue-unbuffered-cursor) (cons -1 (void)))
359(define (queue-unbuffered-cursor? c) (pair? c))
360(define (queue-unbuffered-cursor-index c) (car c))
361(define (queue-unbuffered-cursor-index-set! c v) (set-car! c v))
362
363(define (queue-unbuffered-cursor-winding? q c)
364  (fx<= 0 (queue-unbuffered-cursor-index c)) )
365
366(define (queue-unbuffered-cursor-unwound? q c)
367  (fx= 1 (queue-unbuffered-cursor-index c)) )
368
369(define (queue-unbuffered-cursor-start! q c)
370  (queue-unbuffered-cursor-index-set! c 0) )
371
372;#!eof | *
373(define (queue-unbuffered-cursor-next! q c)
374  (cond
375    ((queue-unbuffered-cursor-unwound? q c) #!eof)
376    ((not (queue-unbuffered-maybe? q))      #!eof)
377    (else
378      (queue-unbuffered-cursor-index-set! c 1)
379      (queue-unbuffered-value q) ) ) )
380
381(define (queue-unbuffered-cursor-continue! q c)
382  (queue-unbuffered-cursor-index-set! c 0) )
383
384(define (queue-unbuffered-cursor-rewind! q c)
385  (queue-unbuffered-cursor-index-set! c -1) )
386
387(define (queue-unbuffered-cursor-extract! q c)
388  ;unless 'mailbox-cursor-next' has been called don't remove
389  (when (queue-unbuffered-cursor-winding? q c)
390    (queue-unbuffered-maybe-set! q #f) ) )
391
392(define (queue-unbuffered-delete! q x)
393  (when (and (queue-unbuffered-maybe? q) (eq? (queue-unbuffered-value q) x))
394    (queue-unbuffered-maybe-set! q #f) ) )
395
396(define (queue-unbuffered->list q)
397  (if (queue-unbuffered-maybe? q)
398    (list (queue-unbuffered-value q ))
399    '() ) )
400
401;; Queue Generic
402
403(define (valid-queue-limit? lm)
404  (or (boolean? lm) (and (fixnum? lm) (positive? lm))) )
405
406(define (make-empty-queue lm)
407  ;(assert (valid-queue-limit? lm))
408  (cond
409    ((not lm)       (make-empty-queue-unlimited))
410    ((fixnum? lm)   (make-empty-queue-limited lm))
411    (else           (make-empty-queue-unbuffered)) ) )
412
413(define (queue? x)
414  (or
415    (queue-unlimited? x)
416    (queue-limited? x)
417    (queue-unbuffered? x) ) )
418
419(define (queue-limit q)
420  (cond
421    ((queue-unlimited? q)  (queue-unlimited-limit q))
422    ((queue-limited? q)    (queue-limited-limit q))
423    (else                  (queue-unbuffered-limit q)) ) )
424
425(define (queue-count q)
426  (cond
427    ((queue-unlimited? q)  (queue-unlimited-count q))
428    ((queue-limited? q)    (queue-limited-count q))
429    (else                  (queue-unbuffered-count q)) ) )
430
431(define (queue-room q)
432  (cond
433    ((queue-unlimited? q)  (queue-unlimited-room q))
434    ((queue-limited? q)    (queue-limited-room q))
435    (else                  (queue-unbuffered-room q)) ) )
436
437(define (queue-empty? q #!optional (n 0))
438  (cond
439    ((queue-unlimited? q)  (queue-unlimited-empty? q))
440    ((queue-limited? q)    (queue-limited-empty? q))
441    (else                  (queue-unbuffered-empty? q)) ) )
442
443(define (queue-full? q #!optional (n 0))
444  (cond
445    ((queue-unlimited? q)  (queue-unlimited-full? q))
446    ((queue-limited? q)    (queue-limited-full? q))
447    (else                  (queue-unbuffered-full? q)) ) )
448
449(define (queue-empty-error loc q) (error loc "queue empty" q))
450(define (queue-full-error loc q v) (error loc "queue full" q v))
451
452(define (queue-add!? q v)
453  (if (queue-full? q)
454    (values #f (void))
455    (values #t
456      (cond
457        ((queue-unlimited? q)  (queue-unlimited-add! q v))
458        ((queue-limited? q)    (queue-limited-add! q v))
459        (else                  (queue-unbuffered-add! q v)))) ) )
460
461(define (queue-remove!? q)
462  (if (queue-empty? q)
463    (values #f (void))
464    (values #t
465      (cond
466        ((queue-unlimited? q)  (queue-unlimited-remove! q))
467        ((queue-limited? q)    (queue-limited-remove! q))
468        (else                  (queue-unbuffered-remove! q)))) ) )
469
470(define (queue-push-back!? q v)
471  (if (queue-full? q)
472    (values #f (void))
473    (values #t
474      (cond
475        ((queue-unlimited? q)  (queue-unlimited-push-back! q v))
476        ((queue-limited? q)    (queue-limited-push-back! q v))
477        (else                  (queue-unbuffered-push-back! q v)))) ) )
478
479(define (queue-push-back-list!? q ls)
480  (if (queue-full? q (length ls))
481    (values #f (void))
482    (values #t
483      (cond
484        ((queue-unlimited? q)  (queue-unlimited-push-back-list! q ls))
485        ((queue-limited? q)    (queue-limited-push-back-list! q ls))
486        (else                  (queue-unbuffered-push-back-list! q ls)))) ) )
487
488(define (queue-add! q v
489                  #!optional
490                  (on-full (lambda () (queue-full-error 'queue-add! q v))))
491  (let loop ()
492    (let-values (((succ? val) (queue-add!? q v)))
493      (unless succ?
494        (on-full)
495        (loop) )
496      val ) ) )
497
498(define (queue-remove! q
499                  #!optional
500                  (on-empty (lambda () (queue-empty-error 'queue-remove! q))))
501  (let loop ()
502    (let-values (((succ? val) (queue-remove!? q)))
503      (unless succ?
504        (on-empty)
505        (loop) )
506      val ) ) )
507
508(define (queue-push-back! q v
509                  #!optional
510                  (on-full (lambda () (queue-full-error 'queue-push-back! q v))))
511  (let loop ()
512    (let-values (((succ? val) (queue-push-back!? q v)))
513      (unless succ?
514        (on-full)
515        (loop) )
516      val ) ) )
517
518(define (queue-push-back-list! q ls
519                  #!optional
520                  (on-full (lambda () (queue-full-error 'queue-push-back-list! q ls))))
521  (let loop ()
522    (let-values (((succ? val) (queue-push-back-list!? q ls)))
523      (unless succ?
524        (on-full)
525        (loop) )
526      val ) ) )
527
528(define (make-queue-cursor q)
529  (cond
530    ((queue-unlimited? q)  (make-queue-unlimited-cursor))
531    ((queue-limited? q)    (make-queue-limited-cursor))
532    (else                  (make-queue-unbuffered-cursor)) ) )
533
534(define (queue-cursor-winding? q c)
535  (cond
536    ((queue-unlimited? q)  (queue-unlimited-cursor-winding? q c))
537    ((queue-limited? q)    (queue-limited-cursor-winding? q c))
538    (else                  (queue-unbuffered-cursor-winding? q c)) ) )
539
540(define (queue-cursor-unwound? q c)
541  (cond
542    ((queue-unlimited? q)  (queue-unlimited-cursor-unwound? q c))
543    ((queue-limited? q)    (queue-limited-cursor-unwound? q c))
544    (else                  (queue-unbuffered-cursor-unwound? q c)) ) )
545
546(define (queue-cursor-rewind! q c)
547  (cond
548    ((queue-unlimited? q)  (queue-unlimited-cursor-rewind! q c))
549    ((queue-limited? q)    (queue-limited-cursor-rewind! q c))
550    (else                  (queue-unbuffered-cursor-rewind! q c)) ) )
551
552(define (queue-cursor-start! q c)
553  (cond
554    ((queue-unlimited? q)  (queue-unlimited-cursor-start! q c))
555    ((queue-limited? q)    (queue-limited-cursor-start! q c))
556    (else                  (queue-unbuffered-cursor-start! q c)) ))
557
558;#!eof | *
559(define (queue-cursor-next! q c)
560 (cond
561    ((queue-unlimited? q)  (queue-unlimited-cursor-next! q c))
562    ((queue-limited? q)    (queue-limited-cursor-next! q c))
563    (else                  (queue-unbuffered-cursor-next! q c)) ))
564
565(define (queue-cursor-continue! q c)
566 (cond
567    ((queue-unlimited? q)  (queue-unlimited-cursor-continue! q c))
568    ((queue-limited? q)    (queue-limited-cursor-continue! q c))
569    (else                  (queue-unbuffered-cursor-continue! q c)) ))
570
571(define (queue-cursor-extract! q c)
572  (cond
573    ((queue-unlimited? q)  (queue-unlimited-cursor-extract! q c))
574    ((queue-limited? q)    (queue-limited-cursor-extract! q c))
575    (else                  (queue-unbuffered-cursor-extract! q c)) ) )
576
577(define (queue-delete! q x)
578  (cond
579    ((queue-unlimited? q)  (queue-unlimited-delete! q x))
580    ((queue-limited? q)    (queue-limited-delete! q x))
581    (else                  (queue-unbuffered-delete! q x)) ) )
582
583(define (queue->list q)
584  (cond
585    ((queue-unlimited? q)  (queue-unlimited->list q))
586    ((queue-limited? q)    (queue-limited->list q))
587    (else                  (queue-unbuffered->list q)) ) )
Note: See TracBrowser for help on using the repository browser.