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

Add built-in function to generate range of numbers between min and max #2479

Closed
tsandall opened this issue Jun 22, 2020 · 1 comment · Fixed by #2517
Closed

Add built-in function to generate range of numbers between min and max #2479

tsandall opened this issue Jun 22, 2020 · 1 comment · Fixed by #2517
Assignees

Comments

@tsandall
Copy link
Member

tsandall commented Jun 22, 2020

A few recent use cases could have used a built-in function to generate a range of integers between two numbers. For example:

a = -1
b = 3
numbers.range(a, b) == [-1,0,1,2,3]
numbers.range(a, a) == [-1]
numbers.range(b, a) == [3,2,1,0,-1]

Note, since OPA supports arbitrary-precision numbers, we should use big.Int for the implementation.

@tsandall
Copy link
Member Author

@frankiecerk this is another good one that you could pickup.

@tsandall tsandall self-assigned this Jul 8, 2020
tsandall added a commit to tsandall/opa that referenced this issue Jul 10, 2020
This commit adds a new built-in function to generate a range of
integers between two values (inclusive). This is useful in certain
cases where users need to enumerate a set of values (e.g., port
numbers).

Fixes open-policy-agent#2479

Signed-off-by: Torin Sandall <[email protected]>
patrick-east pushed a commit that referenced this issue Jul 14, 2020
This commit adds a new built-in function to generate a range of
integers between two values (inclusive). This is useful in certain
cases where users need to enumerate a set of values (e.g., port
numbers).

Fixes #2479

Signed-off-by: Torin Sandall <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant