unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Appending Queues
@ 2012-10-28 19:59 Noah Lavine
  2012-11-02 17:20 ` Ian Price
  0 siblings, 1 reply; 4+ messages in thread
From: Noah Lavine @ 2012-10-28 19:59 UTC (permalink / raw)
  To: guile-devel

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-02 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-28 19:59 Appending Queues Noah Lavine
2012-11-02 17:20 ` Ian Price
2012-11-02 18:00   ` Noah Lavine
2012-11-02 22:11   ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).