Article View: pl.comp.lang.ruby
Article #377Tabela o długości 3 a przedział [3,1]
From: Jan Słupicki
Date: Mon, 01 Jan 2007 22:17
Date: Mon, 01 Jan 2007 22:17
21 lines
1657 bytes
1657 bytes
Jaki właściwie jest cel takiego zachowania Array: irb(main):001:0> a = ["0","1","2"] => ["0", "1", "2"] irb(main):002:0> a[2,1] => ["2"] irb(main):003:0> a[3,1] => [] irb(main):004:0> a[4,1] => nil irb(main):005:0> a[3] => nil Chodzi mi o to że a[3] nie istnieje i słusznie a[3] daje nil to czemu a[3,1] daje [] ? Na mój gust powinno być tak że a[3,1] = a[4,1] = [] lub a[3,1] = a[4,1] = nil. Każdy przedział zaczynający się od indeksu którego nie ma w tabeli powinien się zachowywać tak samo - czemu zrobiono wyjątek dla przedziałów zaczynających się od elementu 'ostatni+1' ? -- Jan Słupicki
Technical Details
Message-ID:
<enc18q$j06$1@atena.e-wro.net>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.e-wro.pl!not-for-mailShow 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.e-wro.pl!not-for-mail From: Jan Słupicki <j.slupicki@provider.pl> Newsgroups: pl.comp.lang.ruby Subject: Tabela o długości 3 a przedział [3,1] Date: Mon, 1 Jan 2007 23:17:08 +0100 Organization: Miejskie Sieci Informatyczne e-wro Lines: 22 Message-ID: <enc18q$j06$1@atena.e-wro.net> NNTP-Posting-Host: h82-143-144-44-static.e-wro.net.pl Mime-Version: 1.0 X-Trace: atena.e-wro.net 1167689819 19462 82.143.144.44 (1 Jan 2007 22:16:59 GMT) X-Complaints-To: abuse@e-wro.pl NNTP-Posting-Date: Mon, 1 Jan 2007 22:16:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Antivirus: avast! (VPS 0666-1, 2006-12-31), Outbound message X-Antivirus-Status: Not-Tested Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit