Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metagn/sliceutils
Utilities using Slice
https://github.com/metagn/sliceutils
iterators library nim ordinals slice utilities
Last synced: 14 days ago
JSON representation
Utilities using Slice
- Host: GitHub
- URL: https://github.com/metagn/sliceutils
- Owner: metagn
- Created: 2020-11-19T10:50:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-11T12:24:30.000Z (over 1 year ago)
- Last Synced: 2024-10-14T15:03:10.863Z (4 months ago)
- Topics: iterators, library, nim, ordinals, slice, utilities
- Language: Nim
- Homepage: https://metagn.github.io/sliceutils/docs/sliceutils.html
- Size: 46.9 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# sliceutils
Nimble package for extensions on Slice/HSlice. Features include:
* `sliceutils/tuples`: indexing tuples by backwards index and by slices of ordinals or backwards indexes
* `sliceutils/strides`: slice type with custom increments other than 1
* `sliceutils/until`: slice utility type that counts every element except the last one, made with floats in mind
* `sliceutils/intslices`: utility procedures for integer slices
- subscript indexing for integer slices with ordinals, backwards indexes, or slices of ordinals or backwards indexes
- `diff(HSlice[T, U: SomeInteger]): int`: the distance between the 2 bounds, has alias `abs`
* `sliceutils/general`: procedures for generic slices, examples being
- `to(T, U) -> HSlice[T, U]`: alternate constructor for slices
- `swap(HSlice[T, U]) -> HSlice[U, T]`: swaps the bounds of the slice
- `sort(Slice[T]) -> Slice[T]`: gives the bounds ascending order
- `span(HSlice[T, U]) -> int`: alias for `system.len` as `len` in this package means "number of results of an iteration"
- `spans(HSlice[T, U], V) -> bool`: alias for `system.contains` as `contains` in this package means "is one of the given values of an iteration"
- `@(HSlice[T, U]) -> seq`: makes seq from slice, iterations must match `len``import sliceutils` imports all of these modules.
Tests are ran for multiple backends.
Warning: This package overuses the type system a bit and breaks very easily for versions below 1.4.0. Even on 1.4.0, you may come across Nim bugs.