Email list hosting service & mailing list manager

queue->list, list->queue Shiro Kawai (03 Dec 2014 06:37 UTC)
Re: queue->list, list->queue John Cowan (03 Dec 2014 13:07 UTC)

Re: queue->list, list->queue John Cowan 03 Dec 2014 13:07 UTC

Shiro Kawai scripsit:

>   queue-list instead of queue->list

I actually had that name in an earlier draft, and I agree that it's better.
The same should be done with queue-first-last, I think.

>   make-queue-with-list instead of list->queue

This seems like a pretty good name, or perhaps make-queue-using-list.

>     It's a constructor with special initial value.
>
> If we have queue->list and list->queue, I'd like them to copy the
> storage, even if those can be trivial to implement:

>    (define (queue->list q) (queue-list (queue-copy q)))
>    (define (list->queue l) (apply queue l))

I guess this makes sense, although I want to avoid `apply` because it is
limited in arguments on many Schemes.

> On a side note, don't we want dequeue-all! operation? SLIB and
> Gauche has it; for the name consistency, we can name it like
> queue-remove-all! or something.

Good idea.  I'll add it.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
Even a refrigerator can conform to the XML Infoset, as long as it has
a door sticker saying "No information items inside".  --Eve Maler