|
@@ -4267,6 +4267,85 @@ return $recv($self._streamClass())._on_(self);
|
|
|
}; }),
|
|
|
$globals.SequenceableCollection);
|
|
|
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "pairsCollect:",
|
|
|
+protocol: "enumerating",
|
|
|
+
|
|
|
+args: ["aBlock"],
|
|
|
+source: "pairsCollect: aBlock\x0a\x09\x22Evaluate aBlock with my elements taken two at a time,\x0a\x09and return an Array with the results\x22\x0a\x0a\x09\x22(#(1 'fred' 2 'charlie' 3 'elmer') pairsCollect: [:a :b | b, ' is number ', a printString]) >>> #('fred is number 1' 'charlie is number 2' 'elmer is number 3')\x22\x0a\x0a\x09^ (1 to: self size // 2) collect: [ :index |\x0a\x09\x09aBlock value: (self at: 2 * index - 1) value: (self at: 2 * index) ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["collect:", "to:", "//", "size", "value:value:", "at:", "-", "*"]
|
|
|
+}, function ($methodClass){ return function (aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+return $recv((1)._to_($recv($self._size()).__slash_slash((2))))._collect_((function(index){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(aBlock)._value_value_([$self._at_($recv([(2).__star(index)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["*"]=1
|
|
|
+
|
|
|
+][0]).__minus((1)))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["at:"]=1
|
|
|
+
|
|
|
+][0],$self._at_((2).__star(index)));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({index:index},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"pairsCollect:",{aBlock:aBlock})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.SequenceableCollection);
|
|
|
+
|
|
|
+$core.addMethod(
|
|
|
+$core.method({
|
|
|
+selector: "pairsDo:",
|
|
|
+protocol: "enumerating",
|
|
|
+
|
|
|
+args: ["aBlock"],
|
|
|
+source: "pairsDo: aBlock\x0a\x09\x22Evaluate aBlock with my elements taken two at a time.\x0a\x09If there's an odd number of items, ignore the last one.\x0a\x09Allows use of a flattened array for things that naturally group into pairs.\x0a\x09See also pairsCollect:\x22\x0a\x0a\x09\x22(#(1 'fred' 2 'charlie' 3 'elmer') pairsDo: [:a :b | Transcript cr; show: b, ' is number ', a printString]) >>> #(1 'fred' 2 'charlie' 3 'elmer')\x22\x0a\x0a\x091 to: self size // 2 do: [ :index |\x0a\x09\x09aBlock value: (self at: 2 * index - 1) value: (self at: 2 * index) ]",
|
|
|
+referencedClasses: [],
|
|
|
+
|
|
|
+pragmas: [],
|
|
|
+messageSends: ["to:do:", "//", "size", "value:value:", "at:", "-", "*"]
|
|
|
+}, function ($methodClass){ return function (aBlock){
|
|
|
+var self=this,$self=this;
|
|
|
+
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
+
|
|
|
+(1)._to_do_($recv($self._size()).__slash_slash((2)),(function(index){
|
|
|
+
|
|
|
+return $core.withContext(function($ctx2) {
|
|
|
+
|
|
|
+return $recv(aBlock)._value_value_([$self._at_($recv([(2).__star(index)
|
|
|
+
|
|
|
+,$ctx2.sendIdx["*"]=1
|
|
|
+
|
|
|
+][0]).__minus((1)))
|
|
|
+
|
|
|
+,$ctx2.sendIdx["at:"]=1
|
|
|
+
|
|
|
+][0],$self._at_((2).__star(index)));
|
|
|
+
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({index:index},$ctx1,1)});
|
|
|
+
|
|
|
+}));
|
|
|
+return self;
|
|
|
+
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"pairsDo:",{aBlock:aBlock})});
|
|
|
+
|
|
|
+}; }),
|
|
|
+$globals.SequenceableCollection);
|
|
|
+
|
|
|
$core.addMethod(
|
|
|
$core.method({
|
|
|
selector: "readStream",
|