Article View: pl.comp.lang.ruby
Article #212Re: iteracja po tablicy kazdy z kazdym "ruby-way"
From: Przemysław Kowalczyk
Date: Mon, 02 Oct 2006 20:33
Date: Mon, 02 Oct 2006 20:33
31 lines
1701 bytes
1701 bytes
On Mon, 02 Oct 2006 22:11:21 +0200, Jan Szumiec <jan.szumiec@gmail.com> wrote: >> 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 :) hmm, nie do konca o to mi chodzilo. A i B to ta sama lista, a w dodatku jezeli "przerobie" pare a,b to nie chce juz przerabiac b,a. ale Marcin pokazal juz to, o co mi chodzilo. pzdr szeryf
Technical Details
Message-ID:
<op.tgs92ogqhwe0a4@negative-361apc>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.task.gda.pl!not-for-mailReferences:
<op.tgs6t3unhwe0a4@negative-361apc> <1159819881.635314.95770@e3g2000cwe.googlegroups.com>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.task.gda.pl!not-for-mail From: Przemysław Kowalczyk <szeryf@negativeiq.pl> Newsgroups: pl.comp.lang.ruby Subject: Re: iteracja po tablicy kazdy z kazdym "ruby-way" Date: Mon, 02 Oct 2006 22:33:50 +0200 Organization: CI TASK http://www.task.gda.pl/ Lines: 31 Message-ID: <op.tgs92ogqhwe0a4@negative-361apc> References: <op.tgs6t3unhwe0a4@negative-361apc> <1159819881.635314.95770@e3g2000cwe.googlegroups.com> NNTP-Posting-Host: xdsl-10757.wroclaw.dialog.net.pl Mime-Version: 1.0 X-Trace: news.task.gda.pl 1159821282 12825 84.40.237.5 (2 Oct 2006 20:34:42 GMT) X-Complaints-To: abuse@news.task.gda.pl NNTP-Posting-Date: Mon, 2 Oct 2006 20:34:42 +0000 (UTC) User-Agent: Opera Mail/9.02 (Win32) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit