[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Appending Queues
From: |
Noah Lavine |
Subject: |
Appending Queues |
Date: |
Sun, 28 Oct 2012 15:59:50 -0400 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Appending Queues,
Noah Lavine <=