[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make-queue, queue-front, queue-back, queue-invoke

This page is part of the web mail archives of SRFI 117 from before July 7th, 2015. The new archives for SRFI 117 contain all messages, not just those from before July 7th, 2015.



Shiro Kawai scripsit:

> * It is typical to create a queue with empty initial state, and
>   I think many existing implementations (e.g SLIB) has zero-argument
>   make-queue to do so.  Is there a reason that not to make `k' 
>   optional with the default value 0?

Well, calling (queue) does that.  Is there need for more than one way?
Make-queue is primarily for when you want a queue of size N but you don't
care what's in it.

> * What will happen if I apply queue-front and queue-back on an empty
>   queue?

I think it should say that an error is signaled.  That's what the
implementation does currently.

> * It hit me weird that it has queue-invoke specifically; is it such
>   a common operation to deserve a separate API?  It's one-liner anyway,
>   and I do use queues for such purpose, it's just one of many ways
>   to use the queue.

Maybe not.  What do other people think?

-- 
John Cowan          http://www.ccil.org/~cowan        cowan@xxxxxxxx
Why are well-meaning Westerners so concerned that the opening of a
Colonel Sanders in Beijing means the end of Chinese culture? [...]
We have had Chinese restaurants in America for over a century,
and it hasn't made us Chinese.  On the contrary, we obliged the Chinese
to invent chop suey.            --Marshall Sahlins