Skip to content

Commit

Permalink
hyperized ITEM OF
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jan 3, 2024
1 parent 42c457d commit 233d2f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Snap! (BYOB) History

## in development:
* **Notable Changes:**
* hyperized ITEM OF
* **Notable Fixes:**
* fixed a RESHAPE edge case when passing in a single zero dimension
* made sure ITEM OF returns data matching the shape specified by the query struct

2024-01-03
* new dev version for v9.1.2
* lists: fixed a RESHAPE edge case when passing in a single zero dimension
* lists: made sure ITEM OF returns data matching the shape specified by the query struct
* lists: made sure ITEM OF returns data matching the shape specified by the query struct
* lists: hyperized ITEM OF

## 9.1.1:
* **Notable Fixes:**
Expand Down
8 changes: 6 additions & 2 deletions src/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,17 @@ List.prototype.query = function (indices) {
// assumes a 2D argument list where each slot represents
// the indices to select from a dimension
// e.g. [rows, columns, planes]
var first, select;
var first, rank, select;
if (indices.isEmpty()) {
return this.map(e => e);
}
if (indices.rank() === 1) {
rank = indices.rank();
if (rank === 1) {
return indices.map(i => this.lookup(i));
}
if (rank > 2) {
return indices.map(i => this.query(i));
}
first = indices.at(1);
if (first instanceof List) {
select = first.isEmpty() ?
Expand Down

0 comments on commit 233d2f0

Please sign in to comment.