Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Range arithmetic #116

Open
joshichaitanya3 opened this issue Mar 8, 2022 · 6 comments
Open

[Feature Request] Range arithmetic #116

joshichaitanya3 opened this issue Mar 8, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@joshichaitanya3
Copy link
Collaborator

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?

@joshichaitanya3 joshichaitanya3 added the enhancement New feature or request label Mar 8, 2022
@joshichaitanya3
Copy link
Collaborator Author

I just realized that the above example isn't the greatest, since we can just do 0..1:(1/(N+1)) and it works, but there are other spots where it could be more useful.

@ConduitDan
Copy link
Collaborator

If you want to do this you can do it with Matrix(List(range))/N

We might want to consider a constructor of type Matrix(range) (and Array(range)) to avoid the call to list first?

@eihabhala
Copy link

Nice

@eihabhala
Copy link

eihabhala commented Apr 10, 2023

I am seeing something Amazing with this language. But the Question is How to Build Packages For It appreciated if You Guys Can Point Me With Just That :)

@softmattertheory
Copy link
Contributor

@eihabhala Thanks for the feedback! We are working on detailed information for developers, including how to build packages for our upcoming release.

@eihabhala
Copy link

Thanks 💐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants