Gavin Sinclair wrote:

>>Obviously, I should have tried
>>
>>   puts [].methods.sort.join("\n")
> 
> 
> The "join" method is redundant unless you have modified the output
> separator :)

Thanks.

That's the only problem with POLS ... when I try something and it just works (as it so often does), I keep that idiom in my head forever, when there's almost always a simpler way :-).

I think the only solution is to try to read more of other people's Ruby code, in which case I'd notice things like that and think "I wonder why they don't have join("\n") there?".
 
> I'm pretty sure that ri 1.8b contains values_at.  I'm surprised about rj,
> since I thought it was based on 1.8b.  Anyway, rj is becoming blissfully
> redundant as Dave improves ri.  The pace of that improvement is
> astonishing (see recent Ruby ChangeLog entries).

I downloaded the latest rj from CVS just recently, but that's at home.  I'll make sure to check when I get a chance. Maybe it's there and I was just more sheets to the wind than I remember!

> Anyway, you may want to check rdoc.sf.net to see if your 'ri' is up to
> date with the latest stable release (not the new experimental stuff).

Sadly, the web site is down for maintenance.  I'll check back sometime soon, though.
 
>>Note: I still think that indexing an array with an array of indices is
>>such an obvious thing to try that it should be there, ...
> 
> 
> Not in my opinion, actually.  It makes sense once I see it, but the code
> you presented is unappealing to me: too many [[ and ]] :).  But if that's
> what I'd seen first in Ruby, I probably wouldn't have thought twice.

I guess that's similar to my previous comment about remembering the first thing you see that works ... perhaps this is just a further analogue of duck typing ... imprinting :-).

Cheers,

H.