1. queues
    1. Usage
    2. Programming interface
      1. list->queue
      2. make-queue
      3. queue?
      4. queue-length
      5. queue->list
      6. queue-add!
      7. queue-empty?
      8. queue-first
      9. queue-last
      10. queue-remove!
      11. queue-push-back!
      12. queue-push-back-list!
    3. Author
    4. Repository
    5. License
    6. Version History

queues

Single-ended queue data structure.

Usage

(require-extension queues)

Programming interface

list->queue

[procedure] (list->queue LIST)

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

[procedure] (make-queue)

Returns a newly created queue.

queue?

[procedure] (queue? X)

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

queue-length

[procedure] (queue-length QUEUE)

Returns the current number of items stored in QUEUE.

queue->list

[procedure] (queue->list QUEUE)

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!

[procedure] (queue-add! QUEUE X)

Adds X to the rear of QUEUE.

queue-empty?

[procedure] (queue-empty? QUEUE)

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

queue-first

[procedure] (queue-first QUEUE)

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

queue-last

[procedure] (queue-last QUEUE)

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

queue-remove!

[procedure] (queue-remove! QUEUE)

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

queue-push-back!

[procedure] (queue-push-back! QUEUE ITEM)

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

queue-push-back-list!

[procedure] (queue-push-back-list! QUEUE LIST)

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.