Code Monkey home page Code Monkey logo

sliceutils's Introduction

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.

sliceutils's People

Contributors

metagn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sliceutils's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.