Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/informaticore/toit-ringbuffer
A RingBuffer implementation as a data structure that stores a fixed number of elements and overwrites the oldest elements once the maximum size is reached.
https://github.com/informaticore/toit-ringbuffer
toit toit-language
Last synced: about 2 months ago
JSON representation
A RingBuffer implementation as a data structure that stores a fixed number of elements and overwrites the oldest elements once the maximum size is reached.
- Host: GitHub
- URL: https://github.com/informaticore/toit-ringbuffer
- Owner: Informaticore
- License: mit
- Created: 2023-04-11T14:39:40.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-05T06:17:54.000Z (9 months ago)
- Last Synced: 2024-10-23T20:12:59.362Z (3 months ago)
- Topics: toit, toit-language
- Language: Toit
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ringbuffer
A RingBuffer implementation as a data structure that stores a fixed number of elements and overwrites the oldest elements once the maximum size is reached.## Install
```
jag pkg install ringbuffer
```## Usage:
```
import ringbuffer show *main:
buffer := RingBuffer 32 //initialize the RingBuffer with a size of 32
buffer.append 1.0 //append a value
buffer.append 2.0
buffer.append 3.0
print buffer.average //prints the average value of all added values in the ringbuffer in this case 2.0
```