Email list hosting service & mailing list manager

make-queue, queue-front, queue-back, queue-invoke Shiro Kawai (03 Dec 2014 04:34 UTC)
Re: make-queue, queue-front, queue-back, queue-invoke John Cowan (03 Dec 2014 13:10 UTC)

Re: make-queue, queue-front, queue-back, queue-invoke John Cowan 03 Dec 2014 12:51 UTC

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        xxxxxx@ccil.org
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