No description
Find a file
2023-07-14 12:19:01 +03:00
.github don't deploy pages on pull request 2022-09-15 15:53:31 +03:00
src try fix pairs for slice return type 2022-09-16 11:45:44 +03:00
tests remove multislices 2021-11-27 14:16:36 +03:00
.gitignore 0.1.1: remove unused concepts from tuples, ... 2020-11-19 20:52:18 +03:00
README.md clarify modules in readme 2023-07-14 12:19:01 +03:00
sliceutils.nimble make tuples compile on older versions 2022-09-16 11:43:33 +03:00

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.