Collections always return results on an new instance of its own #species. That is fabulous to me. It is what's desired most times. With that in mind, if you expected a bag or something else, you should convert (asXXX) before the collect. Cheers
r. From: [email protected] [mailto:[email protected]] On Behalf Of Clara Allende Sent: 27 October 2011 14:15 To: [email protected] Subject: [Pharo-project] aSet collect: answers aSet?? Hi guys.. This morning some students came with an exercise like this: (Set with: 1 with: 2 with:3 with:4 with:5) collect:[:e | e even]. a Set(false true) But they don't want to get aSet, (regardless this particular example doesn't make sense)... the question is, why if I send collect: to aSet I get aSet and not aBag? What happens if I *want* repeated elements after the transformation? :( And when did this behavior change? -- "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." Linus Torvalds This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.
