🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #211

Re: iteracja po tablicy kazdy z kazdym "ruby-way"

#211
From: Jan Szumiec
Date: Mon, 02 Oct 2006 20:11
28 lines
1734 bytes
Przemysław Kowalczyk wrote:
> Witam,
>
> mam taki akademicki problem: jak zrobic jakas operacje na kazdej parze
> elementow z jakiejs listy (tzn. kazdy z kazdym)? na razie robie to tak:
>
> for i in 0..lst.size - 1
> 	for j in i + 1..lst.size - 1
> 		do_something(lst [i], lst [j])
> 	end
> end
>

A = [ .... ]
B = [ .... ]

A.each do | a |
   B.each do | b |
      do_something a, b
   end
end

Ewentualnie... zaimplementować sobie operację * na listach która
zwraca cosik co bierze blok dwuargumentowy :)

Pozdrawiam,
jasiek
Technical Details
Message-ID: <1159819881.635314.95770@e3g2000cwe.googlegroups.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail
References: <op.tgs6t3unhwe0a4@negative-361apc>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.glorb.com!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail
From: "Jan Szumiec" <jan.szumiec@gmail.com>
Newsgroups: pl.comp.lang.ruby
Subject: Re: iteracja po tablicy kazdy z kazdym "ruby-way"
Date: 2 Oct 2006 13:11:21 -0700
Organization: http://groups.google.com
Lines: 29
Message-ID: <1159819881.635314.95770@e3g2000cwe.googlegroups.com>
References: <op.tgs6t3unhwe0a4@negative-361apc>
NNTP-Posting-Host: 83.13.74.122
Mime-Version: 1.0
X-Trace: posting.google.com 1159819887 3559 127.0.0.1 (2 Oct 2006 20:11:27 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 2 Oct 2006 20:11:27 +0000 (UTC)
In-Reply-To: <op.tgs6t3unhwe0a4@negative-361apc>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: e3g2000cwe.googlegroups.com; posting-host=83.13.74.122;   posting-account=FMiszA0AAABQtkerBRSLjEJiW7XY2eLK
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit