summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhistory.txt8
-rw-r--r--lists.js22
-rw-r--r--threads.js10
3 files changed, 16 insertions, 24 deletions
diff --git a/history.txt b/history.txt
index d00869d..a9a711c 100755
--- a/history.txt
+++ b/history.txt
@@ -2007,7 +2007,7 @@ ______
* Blocks: Prevent „hide“ menu option for non-palette template blocks
* new Catalan translation! Yay, thanks, Bernat Romagosa Carrasquer!!
-132226
+131126
------
* Cloud: fixed #125 (encode email address when signing up), thanks, Nathan!
* Threads: fixed #207 (stricter comparison of strings vs. numbers). Some edge cases remain, such as empty string equals zero and disregarding trailing / leading blanks. These are intentional. Please don’t nitpick and spare me the fundamentalism :-)
@@ -2018,3 +2018,9 @@ ______
* Threads: fixed #179 - don’t identify primitive (static) C-Slots as implicit formal parameters
* Threads: fixed #249 - preserve variable value types with edge cases (empty string, Boolean false)
* Threads: fixed #133 - preserve edge-cased argument types (empty string, Boolean false)
+* Fixed issue #244 (relabelling now preserves empty input slots), thanks, Nathan!
+
+131204
+------
+* Threads: handle text comparisons case-insensitive (again)
+* Lists: harmonize equality testing and List CONTAINS testing
diff --git a/lists.js b/lists.js
index 2bbcd0b..60cd7e3 100644
--- a/lists.js
+++ b/lists.js
@@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph,
StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph,
MenuMorph, snapEquals, Morph, isNil, localize, MorphicPreferences*/
-modules.lists = '2013-October-08';
+modules.lists = '2013-December-04';
var List;
var ListWatcherMorph;
@@ -209,30 +209,18 @@ List.prototype.at = function (index) {
};
List.prototype.contains = function (element) {
- var num = parseFloat(element);
if (this.isLinked) {
- if (this.first === element) {
+ if (snapEquals(this.first, element)) {
return true;
}
- if (!isNaN(num)) {
- if (parseFloat(this.first) === num) {
- return true;
- }
- }
if (this.rest instanceof List) {
return this.rest.contains(element);
}
- return false;
}
// in case I'm arrayed
- if (contains(this.contents, element)) {
- return true;
- }
- if (!isNaN(num)) {
- return (contains(this.contents, num))
- || contains(this.contents, num.toString());
- }
- return false;
+ return this.contents.some(function (any) {
+ return snapEquals(any, element);
+ });
};
// List conversion:
diff --git a/threads.js b/threads.js
index 78831cf..727aedf 100644
--- a/threads.js
+++ b/threads.js
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/
// Global stuff ////////////////////////////////////////////////////////
-modules.threads = '2013-November-26';
+modules.threads = '2013-December-04';
var ThreadManager;
var Process;
@@ -104,14 +104,12 @@ function snapEquals(a, b) {
x = a;
y = b;
}
- /*
- // handle text comparision text-insensitive.
- // I think this is a pedagogical feature for novices,
- // but some teachers disagree. Commented out for now.
+
+ // handle text comparision text-insensitive.
if (isString(x) && isString(y)) {
return x.toLowerCase() === y.toLowerCase();
}
- */
+
return x === y;
}