https://github.com/phoe/phoe-toolbox
Personal utility library
https://github.com/phoe/phoe-toolbox
Last synced: 4 months ago
JSON representation
Personal utility library
- Host: GitHub
- URL: https://github.com/phoe/phoe-toolbox
- Owner: phoe
- License: bsd-2-clause
- Created: 2017-09-25T14:38:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T15:38:04.000Z (over 5 years ago)
- Last Synced: 2025-02-24T04:27:01.804Z (over 1 year ago)
- Language: Common Lisp
- Size: 97.7 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHOE-TOOLBOX - A personal utility library
This is a collection of Lisp utilities that I have collected, and will have
collected, over time.
All exported functions are expected to be documented.
## PHOE-TOOLBOX/BAG
A bag is a simple data structure that allows the following:
* Inserting elements in O(n)
* Retrieving elements at random in O(1)
* Returning the count of all elements in O(1)
Basically, if a stack is LIFO, if a queue is FIFO, then a bag is RIRO (random
in, random out).
They are of type `BAG` and are created via `MAKE-BAG`. Contents of a bag are an
unspecialized adjustable vector accessible via `BAG-CONTENTS`. You can
`BAG-INSERT` an element into a bag, `BAG-COUNT` to get the element count,
`BAG-REMOVE` an element from the bag and, additionally, `BAG-COMPRESS` the bag's
internal vector.