replaced "length of list" primitive with new "attribute of list" reporter

pull/95/head
jmoenig 2021-02-05 19:08:39 +01:00
rodzic 8e0dd119e4
commit 2de1d21a0f
2 zmienionych plików z 16 dodań i 13 usunięć

Wyświetl plik

@ -13,6 +13,7 @@
* new manual for v6.6, thanks, Brian! * new manual for v6.6, thanks, Brian!
* objects: don't show internal "compile" reporter in search results * objects: don't show internal "compile" reporter in search results
* blocks, objects, threads: added experimental "atribute of list" reporter primitive to dev mode * blocks, objects, threads: added experimental "atribute of list" reporter primitive to dev mode
* replaced "length of list" primitive with new "attribute of list" reporter
### 2021-02-04 ### 2021-02-04
* lists, threads: changed query semantics for table selectors in ITEM OF to rows, columns, planes, etc. * lists, threads: changed query semantics for table selectors in ITEM OF to rows, columns, planes, etc.

Wyświetl plik

@ -1324,13 +1324,12 @@ SpriteMorph.prototype.initBlocks = function () {
category: 'lists', category: 'lists',
spec: 'all but first of %l' spec: 'all but first of %l'
}, },
reportListLength: { reportListLength: { // deprecated as of v6.6
type: 'reporter', type: 'reporter',
category: 'lists', category: 'lists',
spec: 'length of %l' spec: 'length of %l'
}, },
reportListAttribute: { // only in dev mode - experimental reportListAttribute: {
dev: true,
type: 'reporter', type: 'reporter',
category: 'lists', category: 'lists',
spec: '%la of %l', spec: '%la of %l',
@ -1587,6 +1586,16 @@ SpriteMorph.prototype.initBlockMigrations = function () {
reportTableRotated: { reportTableRotated: {
selector: 'reportTranspose', selector: 'reportTranspose',
offset: 0 offset: 0
},
reportTranspose: {
selector: 'reportListAttribute',
inputs: [['transpose']],
offset: 1
},
reportListLength: {
selector: 'reportListAttribute',
inputs: [['length']],
offset: 1
} }
}; };
}; };
@ -1728,10 +1737,6 @@ SpriteMorph.prototype.blockAlternatives = {
doHideVar: ['doShowVar'], doHideVar: ['doShowVar'],
// lists // lists
reportCDR: ['reportTranspose', 'reportListLength'],
reportTranspose: ['reportCDR', 'reportListLength'],
reportListLength: ['reportTranspose', 'reportCDR'],
// HOFs // HOFs
reportMap: ['reportKeep', 'reportFindFirst'], reportMap: ['reportKeep', 'reportFindFirst'],
reportKeep: ['reportFindFirst', 'reportMap'], reportKeep: ['reportFindFirst', 'reportMap'],
@ -2762,7 +2767,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push(block('reportListItem')); blocks.push(block('reportListItem'));
blocks.push(block('reportCDR')); blocks.push(block('reportCDR'));
blocks.push('-'); blocks.push('-');
blocks.push(block('reportListLength')); blocks.push(block('reportListAttribute'));
blocks.push(block('reportListIndex')); blocks.push(block('reportListIndex'));
blocks.push(block('reportListContainsItem')); blocks.push(block('reportListContainsItem'));
blocks.push(block('reportListIsEmpty')); blocks.push(block('reportListIsEmpty'));
@ -2794,7 +2799,6 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push(txt); blocks.push(txt);
blocks.push('-'); blocks.push('-');
blocks.push(block('doShowTable')); blocks.push(block('doShowTable'));
blocks.push(block('reportListAttribute'));
} }
///////////////////////////////// /////////////////////////////////
@ -2950,10 +2954,9 @@ SpriteMorph.prototype.freshPalette = function (category) {
'reportCONS', 'reportCONS',
'reportListItem', 'reportListItem',
'reportCDR', 'reportCDR',
'reportListLength', 'reportListAttribute',
'reportListIndex', 'reportListIndex',
'reportConcatenatedLists', 'reportConcatenatedLists',
// 'reportTranspose',
'reportListContainsItem', 'reportListContainsItem',
'reportListIsEmpty', 'reportListIsEmpty',
'doForEach', 'doForEach',
@ -8924,7 +8927,7 @@ StageMorph.prototype.blockTemplates = function (category) {
blocks.push(block('reportListItem')); blocks.push(block('reportListItem'));
blocks.push(block('reportCDR')); blocks.push(block('reportCDR'));
blocks.push('-'); blocks.push('-');
blocks.push(block('reportListLength')); blocks.push(block('reportListAttribute'));
blocks.push(block('reportListIndex')); blocks.push(block('reportListIndex'));
blocks.push(block('reportListContainsItem')); blocks.push(block('reportListContainsItem'));
blocks.push(block('reportListIsEmpty')); blocks.push(block('reportListIsEmpty'));
@ -8956,7 +8959,6 @@ StageMorph.prototype.blockTemplates = function (category) {
blocks.push(txt); blocks.push(txt);
blocks.push('-'); blocks.push('-');
blocks.push(block('doShowTable')); blocks.push(block('doShowTable'));
blocks.push(block('reportListAttribute'));
} }
///////////////////////////////// /////////////////////////////////