Skip to content

[Feature Request] Range arithmetic #116

Open
@joshichaitanya3

Description

As the recent issues point out, the Ranges are tricky with floats as spacing. It'd be nice to be able to do arithmetic on Ranges, so that we can have Ranges generated from integers and multiplied by the required spacing later on. Something like this

// Go from 0 to 1 in N+1 steps
var N = 10
var range = 0..N // I think this is always exact?
range = range/N // This operation, if possible, would give a Range going from 0 to 1 exactly in N+1 steps, without worrying about floating point.

Alternatively or additionally, we could have a different kind of Range object going from a to b in a fixed number of steps (like NumPy's linspace), may be with the notation a..b::N or something?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions