kopia lustrzana https://github.com/backface/turtlestitch
hyperdyadic less / great than or equals prims reachable via "relabel"
rodzic
ffd09d21e8
commit
1c6cafe9d2
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
* **New Features:**
|
* **New Features:**
|
||||||
* hyperdyadic MIN and MAX primitives reachable via "relabel"
|
* hyperdyadic MIN and MAX primitives reachable via "relabel"
|
||||||
|
* hyperdyadic less / great than or equals primitives reachable via "relabel"
|
||||||
* **Notable Changes:**
|
* **Notable Changes:**
|
||||||
* searching for blocks and keyboard entry now includes the contents of dropdown menus
|
* searching for blocks and keyboard entry now includes the contents of dropdown menus
|
||||||
* **Notable Fixes:**
|
* **Notable Fixes:**
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
|
|
||||||
### 2020-12-01
|
### 2020-12-01
|
||||||
* threads, objects: added hyperdyadic MIN and MAX primitives reachable via "relabel"
|
* threads, objects: added hyperdyadic MIN and MAX primitives reachable via "relabel"
|
||||||
|
* threads, objects: added hyperdyadic less/greaterThanOrEquals prims
|
||||||
|
|
||||||
### 2020-11-30
|
### 2020-11-30
|
||||||
* threads: keep internal linked-list organization intact for hyperblocks
|
* threads: keep internal linked-list organization intact for hyperblocks
|
||||||
|
|
|
@ -1122,21 +1122,31 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
spec: 'pick random %n to %n',
|
spec: 'pick random %n to %n',
|
||||||
defaults: [1, 10]
|
defaults: [1, 10]
|
||||||
},
|
},
|
||||||
reportLessThan: {
|
|
||||||
type: 'predicate',
|
|
||||||
category: 'operators',
|
|
||||||
spec: '%s < %s'
|
|
||||||
},
|
|
||||||
reportEquals: {
|
reportEquals: {
|
||||||
type: 'predicate',
|
type: 'predicate',
|
||||||
category: 'operators',
|
category: 'operators',
|
||||||
spec: '%s = %s'
|
spec: '%s = %s'
|
||||||
},
|
},
|
||||||
|
reportLessThan: {
|
||||||
|
type: 'predicate',
|
||||||
|
category: 'operators',
|
||||||
|
spec: '%s < %s'
|
||||||
|
},
|
||||||
|
reportLessThanOrEquals: {
|
||||||
|
type: 'predicate',
|
||||||
|
category: 'operators',
|
||||||
|
spec: '%s \u2264 %s'
|
||||||
|
},
|
||||||
reportGreaterThan: {
|
reportGreaterThan: {
|
||||||
type: 'predicate',
|
type: 'predicate',
|
||||||
category: 'operators',
|
category: 'operators',
|
||||||
spec: '%s > %s'
|
spec: '%s > %s'
|
||||||
},
|
},
|
||||||
|
reportGreaterThanOrEquals: {
|
||||||
|
type: 'predicate',
|
||||||
|
category: 'operators',
|
||||||
|
spec: '%s \u2265 %s'
|
||||||
|
},
|
||||||
reportAnd: {
|
reportAnd: {
|
||||||
type: 'predicate',
|
type: 'predicate',
|
||||||
category: 'operators',
|
category: 'operators',
|
||||||
|
@ -1654,9 +1664,12 @@ SpriteMorph.prototype.blockAlternatives = {
|
||||||
'reportQuotient', 'reportPower', 'reportModulus', 'reportMax'],
|
'reportQuotient', 'reportPower', 'reportModulus', 'reportMax'],
|
||||||
reportMax: ['reportSum', 'reportDifference', 'reportProduct',
|
reportMax: ['reportSum', 'reportDifference', 'reportProduct',
|
||||||
'reportQuotient', 'reportPower', 'reportModulus', 'reportMin'],
|
'reportQuotient', 'reportPower', 'reportModulus', 'reportMin'],
|
||||||
reportLessThan: ['reportEquals', 'reportGreaterThan'],
|
reportLessThan: ['reportLessThanOrEquals', 'reportEquals',
|
||||||
reportEquals: ['reportLessThan', 'reportGreaterThan'],
|
'reportGreaterThan', 'reportGreaterThanOrEquals'],
|
||||||
reportGreaterThan: ['reportEquals', 'reportLessThan'],
|
reportEquals: ['reportLessThan', 'reportLessThanOrEquals',
|
||||||
|
'reportGreaterThan', 'reportGreaterThanOrEquals'],
|
||||||
|
reportGreaterThan: ['reportGreaterThanOrEquals', 'reportEquals',
|
||||||
|
'reportLessThan', 'reportLessThanOrEquals'],
|
||||||
reportAnd: ['reportOr'],
|
reportAnd: ['reportOr'],
|
||||||
reportOr: ['reportAnd'],
|
reportOr: ['reportAnd'],
|
||||||
|
|
||||||
|
|
|
@ -3743,6 +3743,14 @@ Process.prototype.reportLessThan = function (a, b) {
|
||||||
return this.hyperDyadic(this.reportBasicLessThan, a, b);
|
return this.hyperDyadic(this.reportBasicLessThan, a, b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Process.prototype.reportLessThanOrEquals = function (a, b) {
|
||||||
|
return this.hyperDyadic(
|
||||||
|
(a, b) => !this.reportBasicGreaterThan(a, b),
|
||||||
|
a,
|
||||||
|
b
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.reportBasicLessThan = function (a, b) {
|
Process.prototype.reportBasicLessThan = function (a, b) {
|
||||||
var x = +a,
|
var x = +a,
|
||||||
y = +b;
|
y = +b;
|
||||||
|
@ -3753,20 +3761,18 @@ Process.prototype.reportBasicLessThan = function (a, b) {
|
||||||
return x < y;
|
return x < y;
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.reportNot = function (bool) {
|
|
||||||
if (this.enableHyperOps) {
|
|
||||||
if (bool instanceof List) {
|
|
||||||
return bool.map(each => this.reportNot(each));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// this.assertType(bool, 'Boolean');
|
|
||||||
return !bool;
|
|
||||||
};
|
|
||||||
|
|
||||||
Process.prototype.reportGreaterThan = function (a, b) {
|
Process.prototype.reportGreaterThan = function (a, b) {
|
||||||
return this.hyperDyadic(this.reportBasicGreaterThan, a, b);
|
return this.hyperDyadic(this.reportBasicGreaterThan, a, b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Process.prototype.reportGreaterThanOrEquals = function (a, b) {
|
||||||
|
return this.hyperDyadic(
|
||||||
|
(a, b) => !this.reportBasicLessThan(a, b),
|
||||||
|
a,
|
||||||
|
b
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.reportBasicGreaterThan = function (a, b) {
|
Process.prototype.reportBasicGreaterThan = function (a, b) {
|
||||||
var x = +a,
|
var x = +a,
|
||||||
y = +b;
|
y = +b;
|
||||||
|
@ -3781,6 +3787,16 @@ Process.prototype.reportEquals = function (a, b) {
|
||||||
return snapEquals(a, b);
|
return snapEquals(a, b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Process.prototype.reportNot = function (bool) {
|
||||||
|
if (this.enableHyperOps) {
|
||||||
|
if (bool instanceof List) {
|
||||||
|
return bool.map(each => this.reportNot(each));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// this.assertType(bool, 'Boolean');
|
||||||
|
return !bool;
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.reportIsIdentical = function (a, b) {
|
Process.prototype.reportIsIdentical = function (a, b) {
|
||||||
var tag = 'idTag';
|
var tag = 'idTag';
|
||||||
if (this.isImmutable(a) || this.isImmutable(b)) {
|
if (this.isImmutable(a) || this.isImmutable(b)) {
|
||||||
|
|
Ładowanie…
Reference in New Issue