From 4d5dad807b629486aa0c4cbe5725a5bc1a61487d Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 8 Oct 2013 16:59:55 +0200 Subject: experimental MAP primitive reporter in lists category, visible in dev mode for now --- threads.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'threads.js') diff --git a/threads.js b/threads.js index a705f28..ee28e59 100644 --- a/threads.js +++ b/threads.js @@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2013-October-04'; +modules.threads = '2013-October-08'; var ThreadManager; var Process; @@ -778,7 +778,7 @@ Process.prototype.evaluate = function ( runnable.isImplicitLambda = context.isImplicitLambda; runnable.isCustomBlock = false; - // assing parameters if any were passed + // assign parameters if any were passed if (parms.length > 0) { // assign formal parameters @@ -1515,6 +1515,18 @@ Process.prototype.doWaitUntil = function (goalCondition) { this.pushContext(); }; +Process.prototype.reportMap = function (reporter, list) { + if (this.context.inputs.length - 2 === list.length()) { + this.returnValueToParentContext( + new List(this.context.inputs.slice(2)) + ); + return; + } + var next = list.at(this.context.inputs.length - 1); + this.pushContext(); + this.evaluate(reporter, new List([next])); +}; + // Process interpolated primitives Process.prototype.doWait = function (secs) { -- cgit v1.3.1