You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
10 months ago | |
---|---|---|
.github/workflows | 1 year ago | |
spec | 1 year ago | |
src | 1 year ago | |
.editorconfig | 1 year ago | |
.gitignore | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 10 months ago | |
shard.yml | 1 year ago |
README.md
lifo
A library for working with LIFO like data structures (stacks, queues).
Installation
-
Add the dependency to your
shard.yml
:dependencies: lifo: git: https://git.dergrimm.net/dergrimm/lifo.git
-
Run
shards install
Usage
require "lifo"
stack = Lifo::Stack(String).new(3)
stack.push("Foo")
stack.push("Bar")
stack.push("Baz")
p! stack.pop
# stack.pop # => "Baz"
p! stack.pop
# stack.pop # => "Bar"
p! stack.peek
# stack.peek # => "Foo"
queue = Lifo::Queue(String).new(3)
queue.enqueue("John Doe")
queue.enqueue("Jane Doe")
p! queue.dequeue
# queue.dequeue # => "John Doe"
p! queue.peek
# queue.peek # => "Jane Doe"
Contributing
- Fork it (https://github.com/grimmigerFuchs/lifo/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Dominic Grimm - creator and maintainer