Skip to content

Commit

Permalink
refactored reportRank()
Browse files Browse the repository at this point in the history
  • Loading branch information
jmoenig committed Jan 3, 2024
1 parent 233d2f0 commit 24b2391
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* 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: hyperized ITEM OF
* threads: refactored reportRank()

## 9.1.1:
* **Notable Fixes:**
Expand Down
2 changes: 1 addition & 1 deletion snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<script src="src/symbols.js?version=2023-07-13"></script>
<script src="src/widgets.js?version=2023-05-24"></script>
<script src="src/blocks.js?version=2023-11-24"></script>
<script src="src/threads.js?version=2023-10-29"></script>
<script src="src/threads.js?version=2024-01-03"></script>
<script src="src/objects.js?version=2023-11-30"></script>
<script src="src/scenes.js?version=2022-10-29"></script>
<script src="src/gui.js?version=2024-01-24"></script>
Expand Down
8 changes: 6 additions & 2 deletions src/threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ StagePickerMorph, CustomBlockDefinition, CommentMorph*/

/*jshint esversion: 11, bitwise: false, evil: true*/

modules.threads = '2023-November-29';
modules.threads = '2024-January-03';

var ThreadManager;
var Process;
Expand Down Expand Up @@ -2264,7 +2264,7 @@ Process.prototype.reportListAttribute = function (choice, list) {
this.assertType(list, 'list');
return list.size();
case 'rank':
return list instanceof List ? list.rank() : 0;
return this.reportRank(list);
case 'dimensions':
return list instanceof List ? list.shape() : new List();
case 'flatten':
Expand Down Expand Up @@ -2374,6 +2374,10 @@ Process.prototype.reportListIsEmpty = function (list) {
return list.isEmpty();
};

Process.prototype.reportRank = function (data) {
return data instanceof List ? data.rank() : 0;
};

Process.prototype.doShowTable = function (list) {
// experimental
this.assertType(list, 'list');
Expand Down

0 comments on commit 24b2391

Please sign in to comment.