https://github.com/jur0/lqueue
Double-ended queue with limited length
https://github.com/jur0/lqueue
elixir queue
Last synced: about 1 year ago
JSON representation
Double-ended queue with limited length
- Host: GitHub
- URL: https://github.com/jur0/lqueue
- Owner: jur0
- License: mit
- Created: 2016-10-01T14:33:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-21T00:32:14.000Z (over 7 years ago)
- Last Synced: 2025-04-20T14:58:35.069Z (about 1 year ago)
- Topics: elixir, queue
- Language: Elixir
- Homepage:
- Size: 16.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# LQueue
[](https://travis-ci.org/jur0/lqueue)
[](https://hex.pm/packages/lqueue)
Double-ended queue with limited length. It can hold just specified amount
of elements. If more are added, the elements from the top of the queue are
(by default) discarded and the new ones added to the rear of the queue.
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be
installed by adding `lqueue` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:lqueue, "~> 1.1"}]
end
```
## Usage
The limited queue implements the
[Enumerable](http://elixir-lang.org/docs/stable/elixir/Enumerable.html),
[Collectable](http://elixir-lang.org/docs/stable/elixir/Collectable.html) and
[Inspect](http://elixir-lang.org/docs/stable/elixir/Inspect.html) protocols, so
all the functions from them are available.
Apart from protocol function, there are others, implemented by `LQueue` module:
* `new/1`
* `full?/1`
* `clear/1`
* `max_count/1`
* `push/2`
* `push_front/2`
* `pop/1`
* `pop_rear/1`
* `get/1`
* `get_rear/1`
* `drop/1`
* `drop_rear/1`
* `from_list/2`