diff --git a/HISTORY.md b/HISTORY.md index 15ad81a014..b62b5afd56 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,8 @@ # 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 @@ -8,7 +10,8 @@ 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:** diff --git a/src/lists.js b/src/lists.js index 9b4ff656a3..93ffad85e9 100644 --- a/src/lists.js +++ b/src/lists.js @@ -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() ?