michael@0: if (typeof ParallelArray === "undefined") michael@0: quit(); michael@0: michael@0: x = ParallelArray() michael@0: y = x.shape michael@0: Object.defineProperty(this, "z", { michael@0: get: function() { michael@0: return x.flatten() michael@0: } michael@0: }) michael@0: Object.defineProperty(y, 5, { michael@0: value: this michael@0: }); michael@0: y[8] = z michael@0: valueOf = (function() { michael@0: function f() { michael@0: (.9 % 1) > f michael@0: } michael@0: return f michael@0: })(this, {}) michael@0: x.shape.join() michael@0: michael@0: michael@0: assertArraySeqParResultsEq(range(0, 1024), "filter", function(e, i) { return (i % (1.1)) != 0; }); michael@0: function range(n, m) { michael@0: var result = []; michael@0: for (var i = n; i < m; i++) michael@0: result.push(i); michael@0: return result; michael@0: } michael@0: function assertArraySeqParResultsEq(arr, op, func) { michael@0: arr[op].apply(arr, [func]); michael@0: } michael@0: michael@0: michael@0: function foo(v) { michael@0: if (v < -200) return 0; michael@0: if (v > 200) return 0; michael@0: return v % 1; michael@0: } michael@0: assertEq(foo(0.9), 0.9); michael@0: assertEq(foo(0.9), 0.9);