SequenceableCollection.st
branchjv
changeset 18555 7cc0ec139c8d
parent 18200 3ddc4e7d42c0
parent 18549 98986a4fcc20
child 18715 b89cef9ece60
--- a/SequenceableCollection.st	Wed Jul 01 06:24:17 2015 +0100
+++ b/SequenceableCollection.st	Sat Jul 04 11:52:42 2015 +0100
@@ -401,7 +401,6 @@
 ! !
 
 
-
 !SequenceableCollection methodsFor:'Compatibility-Squeak'!
 
 allButFirst
@@ -5525,12 +5524,14 @@
 !
 
 overlappingPairsCollect: aTwoArgBlock 
-    "Answer the result of evaluating aBlock with all of the overlapping pairs of my elements."
+    "Answer the result of evaluating aBlock with all of the overlapping pairs of my elements.
+     Returns an array, because the block may return any object
+     (eg, if applied to a string, the returned collection could contain anything)"
 
     | mySize "{ Class: SmallInteger }" retval |
 
     mySize := self size.
-    retval := self species ofSize: mySize - 1.
+    retval := Array ofSize: mySize - 1.
     1 to: mySize - 1 do: [:i | 
         retval at: i put: (aTwoArgBlock value: (self at: i) value: (self at: i + 1)) 
     ].
@@ -5538,6 +5539,12 @@
 
     "
      #(1 2 3 4) overlappingPairsCollect: [:a :b | a->b]
+
+     'hello world how nice' overlappingPairsCollect: [:a :b | a,b]
+
+     (('hello worlld aa bb' overlappingPairsCollect: [:a :b | a,b]) 
+        asBag select:[:p | p asSet size = 1])
+             valuesSortedByCounts first
     "
 !
 
@@ -9841,11 +9848,11 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.407 2015-04-09 11:52:46 stefan Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.407 2015-04-09 11:52:46 stefan Exp $'
+    ^ '$Header$'
 ! !