chickadee » queues

queues

Single-ended queue data structure.

Usage

(require-extension queues)

Programming interface

list->queue

list->queue LISTprocedure

Returns LIST converted into a queue, where the first element of the list is the same as the first element of the queue. The resulting queue may share memory with the list and the list should not be modified after this operation.

make-queue

make-queueprocedure

Returns a newly created queue.

queue?

queue? Xprocedure

Returns #t if X is a queue, or #f otherwise.

queue-length

queue-length QUEUEprocedure

Returns the current number of items stored in QUEUE.

queue->list

queue->list QUEUEprocedure

Returns QUEUE converted into a list, where the first element of the list is the same as the first element of the queue. The resulting list is freshly allocated and does not share memory with the queue object.

queue-add!

queue-add! QUEUE Xprocedure

Adds X to the rear of QUEUE.

queue-empty?

queue-empty? QUEUEprocedure

Returns #t if QUEUE is empty, or #f otherwise.

queue-first

queue-first QUEUEprocedure

Returns the first element of QUEUE. If QUEUE is empty an error is signaled

queue-last

queue-last QUEUEprocedure

Returns the last element of QUEUE. If QUEUE is empty an error is signaled

queue-remove!

queue-remove! QUEUEprocedure

Removes and returns the first element of QUEUE. If QUEUE is empty an error is signaled

queue-push-back!

queue-push-back! QUEUE ITEMprocedure

Pushes an item into the first position of a queue, i.e. the next queue-remove! will return ITEM.

queue-push-back-list!

queue-push-back-list! QUEUE LISTprocedure

Pushes the items in item-list back onto the queue, so that (car LIST) becomes the next removable item.

Author

The CHICKEN Team

Repository

This egg is hosted on the CHICKEN Subversion repository:

https://anonymous@code.call-cc.org/svn/chicken-eggs/release/5/queues

If you want to check out the source code repository of this egg and you are not familiar with Subversion, see this page.

License

Copyright (c) 2014, The CHICKEN Team
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 

Version History

1.0
Extracted from data-structures core library unit and released as an egg.

Contents »