I don't know the correct answer, but I am skeptical of one that relies on a specific implementation rather than a specific definition. I would like to see and understand the arguments for one interpretation versus another. Prima facie, the expectation that set behaviour propagates through the implementation is appealing. The correct answer is anything but clear cut On Sat, Sep 7, 2019, 23:03 Kasper Ãsterbye <kasper.osterbye@gmail.com> wrote:
Feature!
collect: forms a new collection of the same kind as its receiver. In this case a set. As the result of your collect: #(1 2 3) asSet collect: #odd) is booleans, the resulting set will contain only to elements (the duplicate odd resulting in true is removed).
collect: thenDo: applies the collect-block to each element of the receiver, and then applies the do to each of those results. You can see the implementation of collect:thenDo: in class Collection.
Best,
Kasper
On 7 September 2019 at 17.22.03, Herby VojÄÃk (herby@mailbox.sk) wrote:
Hello!
---- (#(1 2 3) asSet collect: #odd) do: [ :each | Transcript show: each; cr ]
true false
----
#(1 2 3) asSet collect: #odd thenDo: [ :each | Transcript show: each; cr ]
true false true
Bug or feature?
Herby