refactored hyper-monadic functions to use new list-map()

pull/95/head
jmoenig 2020-05-16 15:44:58 +02:00
rodzic 0130770a41
commit 45b419ad48
1 zmienionych plików z 6 dodań i 18 usunięć

Wyświetl plik

@ -3632,9 +3632,7 @@ Process.prototype.reportBasicLessThan = function (a, b) {
Process.prototype.reportNot = function (bool) {
if (this.enableHyperOps) {
if (bool instanceof List) {
return new List(
bool.asArray().map(each => this.reportNot(each))
);
return bool.map(each => this.reportNot(each));
}
}
return !bool;
@ -3702,9 +3700,7 @@ Process.prototype.reportBoolean = function (bool) {
Process.prototype.reportRound = function (n) {
if (this.enableHyperOps) {
if (n instanceof List) {
return new List(
n.asArray().map(each => this.reportRound(each))
);
return n.map(each => this.reportRound(each));
}
}
return Math.round(+n);
@ -3713,9 +3709,7 @@ Process.prototype.reportRound = function (n) {
Process.prototype.reportMonadic = function (fname, n) {
if (this.enableHyperOps) {
if (n instanceof List) {
return new List(
n.asArray().map(each => this.reportMonadic(fname, each))
);
return n.map(each => this.reportMonadic(fname, each));
}
}
@ -3856,9 +3850,7 @@ Process.prototype.reportBasicLetter = function (idx, string) {
Process.prototype.reportStringSize = function (data) {
if (this.enableHyperOps) {
if (data instanceof List) {
return new List(
data.asArray().map(each => this.reportStringSize(each))
);
return data.map(each => this.reportStringSize(each));
}
}
if (data instanceof List) { // catch a common user error
@ -3872,9 +3864,7 @@ Process.prototype.reportUnicode = function (string) {
if (this.enableHyperOps) {
if (string instanceof List) {
return new List(
string.asArray().map(each => this.reportUnicode(each))
);
return string.map(each => this.reportUnicode(each));
}
str = isNil(string) ? '\u0000' : string.toString();
if (str.length > 1) {
@ -3892,9 +3882,7 @@ Process.prototype.reportUnicode = function (string) {
Process.prototype.reportUnicodeAsLetter = function (num) {
if (this.enableHyperOps) {
if (num instanceof List) {
return new List(
num.asArray().map(each => this.reportUnicodeAsLetter(each))
);
return num.map(each => this.reportUnicodeAsLetter(each));
}
}