diff --git a/HISTORY.md b/HISTORY.md index fd9e5a4a..5d1f31c2 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -20,6 +20,9 @@ * **Translation Updates:** * German +### 2021-02-12 +* blocks, threads, lists: distinguish between "transpose" (<3D) and "deep transpose" + ### 2021-02-11 * objects: rearranged the blocks in the lists category palette * lists: fixed list.reverse() to return a shallow copy instead of mutating the original diff --git a/snap.html b/snap.html index 085c7929..868b37f5 100755 --- a/snap.html +++ b/snap.html @@ -8,12 +8,12 @@ - - + + - + diff --git a/src/blocks.js b/src/blocks.js index 2522b1cd..86ca7e42 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2021-February-09'; +modules.blocks = '2021-February-12'; var SyntaxElementMorph; var BlockMorph; @@ -471,6 +471,7 @@ SyntaxElementMorph.prototype.labelParts = { 'dimensions' : ['dimensions'], 'flatten' : ['flatten'], 'transpose' : ['transpose'], + 'deep transpose' : ['deep transpose'], 'reverse' : ['reverse'], '~' : null, 'lines' : ['lines'], diff --git a/src/lists.js b/src/lists.js index 738eef7e..c70f7392 100644 --- a/src/lists.js +++ b/src/lists.js @@ -63,7 +63,7 @@ MorphicPreferences, TableDialogMorph, SpriteBubbleMorph, SpeechBubbleMorph, TableFrameMorph, TableMorph, Variable, isSnapObject, Costume, contains, detect, ZERO, WHITE*/ -modules.lists = '2021-February-11'; +modules.lists = '2021-February-12'; var List; var ListWatcherMorph; @@ -572,13 +572,16 @@ List.prototype.flatten = function () { }; List.prototype.transpose = function () { - // answer a 2D list where each item has turned into a row, - // convert atomic items into lists, - // fill ragged columns with atomic values, if any, or empty cells - if (this.rank() > 2) { return this.strideTranspose(); } + return this.transpose2D(); +}; + +List.prototype.transpose2D = function () { + // answer a 2D list where each item has turned into a row, + // convert atomic items into lists, + // fill ragged columns with atomic values, if any, or empty cells var col, src, i, width = Math.max(this.width(), 1), diff --git a/src/threads.js b/src/threads.js index c5a734ad..71dea1c9 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2021-February-10'; +modules.threads = '2021-February-12'; var ThreadManager; var Process; @@ -1988,6 +1988,9 @@ Process.prototype.reportListAttribute = function (choice, list) { case 'flatten': return list instanceof List ? list.ravel() : new List([list]); case 'transpose': + this.assertType(list, 'list'); + return list.transpose2D(); + case 'deep transpose': this.assertType(list, 'list'); return list.transpose(); case 'reverse':