Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: An idiomatic way to traverse all pairs in an enumerable?
Trans
12/16/2007 2:21:00 PM
On Dec 15, 6:03 pm, "Shot (Piotr Szotkowski)" <s...@hot.pl> wrote:
> I seem to end up doing the following quite a lot:
>
> enum.each do |a|
> enum.each do |b|
> next if a >= b
> # do_something with a and b
> end
> end
>
> In general, I'm looking for an idiomatic way of traversing each
> possible pair of a given enum's contents (once). Is there a more
> compact construct?
Facets exits for you.
http://facets.rub...
/rdoc/core/classes/Enumerable.ht...
T.
http://facets.rub...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: An idiomatic way to traverse all pairs in an enumerable?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password