Hello,

I was just working on a project that used (ice-9 q), and I found that
I needed to append two queues. I wrote the following functions to do
it. What do you think of including them in (ice-9 q)? It's pretty
simple, but it seems like a natural part of the queue interface. I've
included destructive and non-destructive versions.

The only change I was considering is allowing an arbitrary number of
arguments, but that's something I can implement if people agree that
we want the functions in (ice-9 q).

(define (append-qs q r)
  (cons (append (car q) (car r)) (cdr r)))

(define (append-qs! q r)
  (set-cdr! (cdr q) (car r))
  (set-cdr! q (cdr r))
  q)

Thanks,
Noah

Reply via email to