[squeak-dev] #collect: on strings

Damien Cassou damien.cassou at gmail.com
Wed Jun 25 20:34:47 UTC 2008


On Wed, Jun 25, 2008 at 6:35 PM, Colin Putney <cputney at wiresong.ca> wrote:
>
> On 25-Jun-08, at 1:46 AM, Damien Cassou wrote:
>
>> On Wed, Jun 25, 2008 at 9:39 AM, cdrick <cdrick65 at gmail.com> wrote:
>>>
>>> (Array withAll: 'something') collect: [ :letter | letter isVowel ].
>>> #(false true false true false false true false false)
>>
>> I did that
>>
>> 'something' asArray collect: [ :letter | letter isVowel ].
>>
>> do get the desired behavior. However, it is not intuitive to me.
>
>
> Let's do a thought experiment. What do you intuitively expect from this?
>
> 'something' collect: [:letter | letter asUppercase].
>
> Something other than a String? If it did answer something other than a
> String, would that be more surprising or less surprising than the original
> example?

I'm really expecting a string a here.

-- 
Damien Cassou
Peter von der Ahé: «I'm beginning to see why Gilad wished us good
luck». (http://blogs.sun.com/ahe/entry/override_snafu)



More information about the Squeak-dev mailing list