Right. �I hadn't looked closely enough at the Moose one. �Actually, if you dig it a bit deeper, #writeStream isn't defined in the Collection hierarchy until you get to SequenceableCollection in any case, so the Moose version is defined too high.
So, if there is a desire for #flatCollect: outside of SequenceableColleciton, then this should work (based on Moose version):
Collection>>flatCollect: aBlock�
"Evaluate aBlock for each of the receiver's elements and answer the
list of all resulting values flatten one level. Assumes that aBlock returns some kind
of collection for each element. Equivalent to the lisp's mapcan"
"original written by a. Kuhn and released under MIT"
| result |
self isEmpty ifTrue: [ ^ self copy ].
result�:= (self species new: 0).
self do: [ :each |�result�addAll: (aBlock value: each) ].
^�result
SequenceableCollection>>flatCollect: aBlock�
"Evaluate aBlock for each of the receiver's elements and answer the
list of all resulting values flatten one level. Assumes that aBlock returns some kind
of collection for each element. Equivalent to the lisp's mapcan"
"original written by a. Kuhn and released under MIT"
| stream |
self isEmpty ifTrue: [ ^ self copy ].
^self species streamContents: [ :stream |
self do: [ :each | stream nextPutAll: (aBlock value: each) ]
-Chris
On Mon, Nov 4, 2013 at 8:46 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote: