Skip to content

Commit

Permalink
#2716: placed it inside at.
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Feb 27, 2024
1 parent 4cbe4c2 commit d3bcd1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
18 changes: 9 additions & 9 deletions eo-runtime/src/main/eo/org/eolang/tuple.eo
Expand Up @@ -59,15 +59,15 @@
error "Given index is out of tuple bounds"
^.at-without-checks index

# Takes element from the tuple without checking i.
# i must be less than length and greater or equal 0.
# This is faster than at.
[i] > at-without-checks
i > idx!
if. > @
idx.lt head.length
^.head.at-without-checks idx
^.tail
# Takes element from the tuple without checking i.
# i must be less than length and greater or equal 0.
# This is faster than at.
[i] > at-without-checks
i > idx!
if. > @
idx.lt head.length
^.^.head.at.at-without-checks idx
^.^.tail

# Create a new tuple with this element added to the end of it.
[x] > with
Expand Down
10 changes: 6 additions & 4 deletions eo-runtime/src/test/eo/org/eolang/tuple-tests.eo
Expand Up @@ -175,16 +175,18 @@
# Test
[] > at-without-checks-with-first-element
eq. > @
at.
* 100 101 102
at-without-checks.
at.
* 100 101 102
0
100

# Test
[] > at-without-checks-with-last-element
eq. > @
at.
* 100 101 102
at-without-checks.
at.
* 100 101 102
2
102

Expand Down

0 comments on commit d3bcd1e

Please sign in to comment.