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

Issue with array2d iter, inconsistent behaviour with rows and columns #376

Closed
kalekje opened this issue Apr 19, 2021 · 0 comments · Fixed by #377
Closed

Issue with array2d iter, inconsistent behaviour with rows and columns #376

kalekje opened this issue Apr 19, 2021 · 0 comments · Fixed by #377

Comments

@kalekje
Copy link
Contributor

kalekje commented Apr 19, 2021

Noticed a bug with array2d.iter(). The first loop should print the indexes for the last TWO columns of the matrix M, but it only prints the second column. When I do a similar pattern for the rows, it works as expected.

M = {{1,2,3}, 
     {4,5,6}, 
     {7,8,9}}
for i,j in array2d.iter(M, true, 1, 2, 3, 3) do
    print(i,j)
end
print('----')
for i,j in array2d.iter(M, true, 2, 1, 3, 3) do
    print(i,j)
end

Output:

1	2
2	2
3	2
----
2	1
2	2
2	3
3	1
3	2
3	3
Tieske added a commit that referenced this issue Apr 26, 2021
Tieske added a commit that referenced this issue Apr 26, 2021
Tieske added a commit that referenced this issue Apr 26, 2021
Tieske added a commit that referenced this issue Apr 26, 2021
Tieske added a commit that referenced this issue Apr 26, 2021
Tieske added a commit that referenced this issue Apr 26, 2021
bungle added a commit to Kong/kong that referenced this issue May 6, 2021
### Summary

 - deprecate: `permute.iter`, renamed to `permute.order_iter` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `permute.table`, renamed to `permute.order_table` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `Date` module (removal later)
   [#367](lunarmodules/Penlight#367)
 - feat: `permute.list_iter` to iterate over different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: `permute.list_table` generate table with different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: Lua 5.4 'warn' compatibility function
   [#366](lunarmodules/Penlight#366)
 - feat: deprecation functionality `utils.raise_deprecation`
   [#361](lunarmodules/Penlight#361)
 - feat: `utils.splitv` now takes same args as `split`
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.rmtree` failed to remove symlinks to directories
   [#365](lunarmodules/Penlight#365)
 - fix: `pretty.write` could error out on failing metamethods (Lua 5.3+)
   [#368](lunarmodules/Penlight#368)
 - fix: `app.parse` now correctly parses values containing '=' or ':'
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.makepath` failed to create top-level directories
   [#372](lunarmodules/Penlight#372)
 - overhaul: `array2d` module was updated, got additional tests and several
   documentation updates
   [#377](lunarmodules/Penlight#377)
 - feat: `aray2d` now accepts negative indices
 - feat: `array2d.row` added to align with `column`
 - fix: bad error message in `array2d.map`
 - fix: `array2d.flatten` now ensures to deliver a 'square' result if `nil` is
   encountered
 - feat: `array2d.transpose` added
 - feat: `array2d.swap_rows` and `array2d.swap_cols` now return the array
 - fix: `aray2d.range` correctly recognizes `R` column in spreadsheet format, was
   mistaken for `R1C1` format.
 - fix: `aray2d.range` correctly recognizes 2 char column in spreadsheet format
 - feat: `array2d.default_range` added (previously private)
 - feat: `array2d.set` if used with a function now passes `i,j` to the function
   in line with the `new` implementation.
 - fix: `array2d.iter` didn't properly iterate the indices
   [#376](lunarmodules/Penlight#376)
 - feat: `array2d.columns` now returns a second value; the column index
 - feat: `array2d.rows` added to be in line with `columns`
bungle added a commit to Kong/kong that referenced this issue May 6, 2021
### Summary

 - deprecate: `permute.iter`, renamed to `permute.order_iter` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `permute.table`, renamed to `permute.order_table` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `Date` module (removal later)
   [#367](lunarmodules/Penlight#367)
 - feat: `permute.list_iter` to iterate over different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: `permute.list_table` generate table with different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: Lua 5.4 'warn' compatibility function
   [#366](lunarmodules/Penlight#366)
 - feat: deprecation functionality `utils.raise_deprecation`
   [#361](lunarmodules/Penlight#361)
 - feat: `utils.splitv` now takes same args as `split`
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.rmtree` failed to remove symlinks to directories
   [#365](lunarmodules/Penlight#365)
 - fix: `pretty.write` could error out on failing metamethods (Lua 5.3+)
   [#368](lunarmodules/Penlight#368)
 - fix: `app.parse` now correctly parses values containing '=' or ':'
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.makepath` failed to create top-level directories
   [#372](lunarmodules/Penlight#372)
 - overhaul: `array2d` module was updated, got additional tests and several
   documentation updates
   [#377](lunarmodules/Penlight#377)
 - feat: `aray2d` now accepts negative indices
 - feat: `array2d.row` added to align with `column`
 - fix: bad error message in `array2d.map`
 - fix: `array2d.flatten` now ensures to deliver a 'square' result if `nil` is
   encountered
 - feat: `array2d.transpose` added
 - feat: `array2d.swap_rows` and `array2d.swap_cols` now return the array
 - fix: `aray2d.range` correctly recognizes `R` column in spreadsheet format, was
   mistaken for `R1C1` format.
 - fix: `aray2d.range` correctly recognizes 2 char column in spreadsheet format
 - feat: `array2d.default_range` added (previously private)
 - feat: `array2d.set` if used with a function now passes `i,j` to the function
   in line with the `new` implementation.
 - fix: `array2d.iter` didn't properly iterate the indices
   [#376](lunarmodules/Penlight#376)
 - feat: `array2d.columns` now returns a second value; the column index
 - feat: `array2d.rows` added to be in line with `columns`
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 13, 2021
## 1.10.0 (2021-04-27)

 - deprecate: `permute.iter`, renamed to `permute.order_iter` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `permute.table`, renamed to `permute.order_table` (removal later)
   [#360](lunarmodules/Penlight#360)
 - deprecate: `Date` module (removal later)
   [#367](lunarmodules/Penlight#367)
 - feat: `permute.list_iter` to iterate over different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: `permute.list_table` generate table with different sets of values
   [#360](lunarmodules/Penlight#360)
 - feat: Lua 5.4 'warn' compatibility function
   [#366](lunarmodules/Penlight#366)
 - feat: deprecation functionality `utils.raise_deprecation`
   [#361](lunarmodules/Penlight#361)
 - feat: `utils.splitv` now takes same args as `split`
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.rmtree` failed to remove symlinks to directories
   [#365](lunarmodules/Penlight#365)
 - fix: `pretty.write` could error out on failing metamethods (Lua 5.3+)
   [#368](lunarmodules/Penlight#368)
 - fix: `app.parse` now correctly parses values containing '=' or ':'
   [#373](lunarmodules/Penlight#373)
 - fix: `dir.makepath` failed to create top-level directories
   [#372](lunarmodules/Penlight#372)
 - overhaul: `array2d` module was updated, got additional tests and several
   documentation updates
   [#377](lunarmodules/Penlight#377)
 - feat: `aray2d` now accepts negative indices
 - feat: `array2d.row` added to align with `column`
 - fix: bad error message in `array2d.map`
 - fix: `array2d.flatten` now ensures to deliver a 'square' result if `nil` is
   encountered
 - feat: `array2d.transpose` added
 - feat: `array2d.swap_rows` and `array2d.swap_cols` now return the array
 - fix: `aray2d.range` correctly recognizes `R` column in spreadsheet format, was
   mistaken for `R1C1` format.
 - fix: `aray2d.range` correctly recognizes 2 char column in spreadsheet format
 - feat: `array2d.default_range` added (previously private)
 - feat: `array2d.set` if used with a function now passes `i,j` to the function
   in line with the `new` implementation.
 - fix: `array2d.iter` didn't properly iterate the indices
   [#376](lunarmodules/Penlight#376)
 - feat: `array2d.columns` now returns a second value; the column index
 - feat: `array2d.rows` added to be in line with `columns`


## 1.9.2 (2020-09-27)

 - fix: dir.walk [#350](lunarmodules/Penlight#350)


## 1.9.1 (2020-09-24)

 - released to superseed the 1.9.0 version which was retagged in git after some
   distro's already had picked it up. This version is identical to 1.8.1.

## 1.8.1 (2020-09-24) (replacing a briefly released but broken 1.9.0 version)

## Fixes

  - In `pl.class`, `_init` can now be inherited from grandparent (or older ancestor) classes. [#289](lunarmodules/Penlight#289)
  - Fixes `dir`, `lexer`, and `permute` to no longer use coroutines. [#344](lunarmodules/Penlight#344)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant