-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
function/stdlib: element accepts negative indices
The abstraction offered by this function is that of an infinitely-long list consisting of repeating copies of the input list, but previously we restricted it only to positive indices. Now we'll also treat the indices before zero as a negative extension of the infinite list, for consistency. Technically the list is not actually infinite but rather constrained by the range of an int64 in Go. Ideally we'd relax that too and allow any whole number that's in the full range of cty.Number, but there's no clear benefit to that beyond a theoretical idea of correctness and so we'll save that one for a later change if we discover a real use-case for it.
- Loading branch information
1 parent
15a9d85
commit 7b73cce
Showing
3 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters