[Pharo-users] Set >> collect:thenDo:
kasper.osterbye at gmail.com
Sun Sep 8 02:02:30 EDT 2019
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.
On 7 September 2019 at 17.22.03, Herby Vojčík (herby at mailbox.sk) wrote:
(#(1 2 3) asSet collect: #odd)
do: [ :each | Transcript show: each; cr ]
#(1 2 3) asSet collect: #odd
thenDo: [ :each | Transcript show: each; cr ]
Bug or feature?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-users