Hi Nicolas,

Am Mi., 1. Jan. 2020 um 19:48 Uhr schrieb Thiede, Christoph <Christoph.Thiede@student.hpi.uni-potsdam.de>:

i := 0.
((RunArray new: 4 withAll: 42) collect: [:x | i := i + 1]) asArray. "#(1 1 1 1)""
This one is broken, isn't it? A RunArray is still a collection of elements and the comment of collect: in Collection states:

Evaluate aBlock with each of the receiver's elements as the argument.  
Collect the resulting values into a collection like the receiver. Answer  
the new collection. [emphasis mine]

IMO the storage optimization of RunArray should not affect the meaning of its operations. The intermediary RunArray in the code above should also contain 1, 2, 3, 4, even though it defeats the optimization.

Introduce a new selector for the optimized collect operation?

Kind regards,
Jakob