Yossef Mendelssohn wrote:
> On Mar 4, 3:32pm, "C. Dagnon" <c-soc-rubyfo... / dagnon.net> wrote:
>> >   key = map.keys.detect { |k| k.to_s.downcase ==
>> > matcher.to_s.downcase }
>>
>> Hmmm, what is 'detect'?
> 
> 'detect' is a synonym for 'find' (or maybe it's the other way around).
> 
> I prefer to use the *ect methods when working with Enumerables instead
> of the simpler/shorter synonyms. This is in part because they get some
> consistency and connection, but also because Rails overrides some of
> them on Enumerable-like association proxies. And some of them don't
> even have non-ect synonyms.
> 
>   [].detect  -> [].find
>   [].select  -> [].find_all
>   [].reject  ->
>   [].collect -> [].map
>   [].inject  ->

Interesting...  I hadn't learned about the *ect's.  I have used collect 
(never map, yuck), and now that I see it I think detect is a better word 
for find as used here.  While I think I can find a use for reject and 
inject, select doesn't make much sense to me.  I'll have to see if I can 
fit that into my mindmap...

Thanks for that explanation Yossef!
-- 
Posted via http://www.ruby-forum.com/.