Describe the bug
There is a compilation issue when converting the syntax for reversing a 2D list in Jac, E.g.: two_d_list[::-1];, is incorrectly translated to two_d_list[:-1] in Python. This leads to an unintended slicing of the list, removing the last element, instead of reversing the entire list as expected.
To Reproduce
Steps to reproduce the behavior:
Example Code:
with entry{
(rows, cols) = (5, 5);
two_d_list = [[i ** j for i in range(cols)] for j in range(rows)];
print(two_d_list);
print(two_d_list[::-1]);
}
Converted Python Code:
from future import annotations
rows, cols = (5, 5)
two_d_list = [[i ** j for i in range(cols)] for j in range(rows)]
print(two_d_list)
print(two_d_list[:-1])
Jaclang/Python Version
Python version and Jac version, or installed from source.
jaclang - 0.4.7
Python - 3.11.6
Describe the bug There is a compilation issue when converting the syntax for reversing a 2D list in Jac, E.g.: two_d_list[::-1];, is incorrectly translated to two_d_list[:-1] in Python. This leads to an unintended slicing of the list, removing the last element, instead of reversing the entire list as expected.
To Reproduce Steps to reproduce the behavior: Example Code:
with entry{ (rows, cols) = (5, 5); two_d_list = [[i ** j for i in range(cols)] for j in range(rows)]; print(two_d_list); print(two_d_list[::-1]); }
Output: [[1, 1, 1, 1, 1], [0, 1, 2, 3, 4], [0, 1, 4, 9, 16], [0, 1, 8, 27, 64], [0, 1, 16, 81, 256]] [[1, 1, 1, 1, 1], [0, 1, 2, 3, 4], [0, 1, 4, 9, 16], [0, 1, 8, 27, 64]]
Converted Python Code: from future import annotations rows, cols = (5, 5) two_d_list = [[i ** j for i in range(cols)] for j in range(rows)] print(two_d_list) print(two_d_list[:-1])
Jaclang/Python Version Python version and Jac version, or installed from source. jaclang - 0.4.7 Python - 3.11.6