Skip to content

Commit

Permalink
made sure ITEM OF returns data matching the shape specified by the qu…
Browse files Browse the repository at this point in the history
…ery struct
  • Loading branch information
jmoenig committed Jan 3, 2024
1 parent 24fa14b commit 42c457d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
## in development:
* **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

## 9.1.1:
* **Notable Fixes:**
Expand Down
9 changes: 6 additions & 3 deletions src/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,12 @@ List.prototype.query = function (indices) {
} else {
select = new List([first]);
}
return select.map(i => this.lookup(i)).map(
e => e instanceof List? e.query(indices.cdr()) : e
);
return select.map(i => this.lookup(i)).map(e => {
let rest = indices.cdr();
return e instanceof List ? e.query(rest)
: (rest.isEmpty() ? e
: new List([e]).query(rest));
});
};

List.prototype.slice = function (indices) {
Expand Down

0 comments on commit 42c457d

Please sign in to comment.