|
@@ -591,6 +591,28 @@ return $2;
|
|
messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"]}),
|
|
messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"]}),
|
|
smalltalk.Collection);
|
|
smalltalk.Collection);
|
|
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
|
+smalltalk.method({
|
|
|
|
+selector: "select:thenCollect:",
|
|
|
|
+fn: function (selectBlock,collectBlock){
|
|
|
|
+var self=this;
|
|
|
|
+var stream;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
|
+var $1,$2;
|
|
|
|
+stream=_st(_st(self._class())._new())._writeStream();
|
|
|
|
+self._do_((function(each){
|
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
|
+$1=_st(selectBlock)._value_(each);
|
|
|
|
+if(smalltalk.assert($1)){
|
|
|
|
+return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
|
|
|
|
+};
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
|
|
|
|
+$2=_st(stream)._contents();
|
|
|
|
+return $2;
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},smalltalk.Collection)})},
|
|
|
|
+messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"]}),
|
|
|
|
+smalltalk.Collection);
|
|
|
|
+
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "size",
|
|
selector: "size",
|
|
@@ -1695,17 +1717,6 @@ return $1;
|
|
messageSends: ["at:", "atRandom", "size"]}),
|
|
messageSends: ["at:", "atRandom", "size"]}),
|
|
smalltalk.SequenceableCollection);
|
|
smalltalk.SequenceableCollection);
|
|
|
|
|
|
-smalltalk.addMethod(
|
|
|
|
-smalltalk.method({
|
|
|
|
-selector: "collect:",
|
|
|
|
-fn: function (aBlock){
|
|
|
|
-var self=this;
|
|
|
|
-return smalltalk.withContext(function($ctx1) {
|
|
|
|
-return self.map(function(each) {return aBlock._value_(each)});
|
|
|
|
-return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.SequenceableCollection)})},
|
|
|
|
-messageSends: []}),
|
|
|
|
-smalltalk.SequenceableCollection);
|
|
|
|
-
|
|
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "copyFrom:to:",
|
|
selector: "copyFrom:to:",
|
|
@@ -2150,6 +2161,17 @@ return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObje
|
|
messageSends: []}),
|
|
messageSends: []}),
|
|
smalltalk.Array);
|
|
smalltalk.Array);
|
|
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
|
+smalltalk.method({
|
|
|
|
+selector: "collect:",
|
|
|
|
+fn: function (aBlock){
|
|
|
|
+var self=this;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
|
+return self.map(function(each) {return aBlock._value_(each)});
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},smalltalk.Array)})},
|
|
|
|
+messageSends: []}),
|
|
|
|
+smalltalk.Array);
|
|
|
|
+
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "join:",
|
|
selector: "join:",
|
|
@@ -2233,6 +2255,25 @@ return self}, function($ctx1) {$ctx1.fill(self,"reversed",{},smalltalk.Array)})}
|
|
messageSends: []}),
|
|
messageSends: []}),
|
|
smalltalk.Array);
|
|
smalltalk.Array);
|
|
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
|
+smalltalk.method({
|
|
|
|
+selector: "select:",
|
|
|
|
+fn: function (aBlock){
|
|
|
|
+var self=this;
|
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
|
+
|
|
|
|
+ var result = self.klass._new();
|
|
|
|
+ for(var i=0; i<self.length; i++) {
|
|
|
|
+ if(aBlock._value_(self[i])) {
|
|
|
|
+ result.push(self[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ ;
|
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},smalltalk.Array)})},
|
|
|
|
+messageSends: []}),
|
|
|
|
+smalltalk.Array);
|
|
|
|
+
|
|
smalltalk.addMethod(
|
|
smalltalk.addMethod(
|
|
smalltalk.method({
|
|
smalltalk.method({
|
|
selector: "size",
|
|
selector: "size",
|