7stud2
(7stud --)
20 June 2012 21:27
1
I cannot find an answer to this, and perhaps the answer is that "it is
what it is..." But perhaps someone can explain this for me.
If I have an array, thus:
a = [1, 2, 3, 4]
there are four elements in the array. The indexes are 0..3.
a[4,0] returns []
a[5,0], however, returns nil
Both of these are outside the scope of the array, aren't they? I would
think they would return the same thing, either nil or the empty array.
Any help? Thanks!
John
···
--
Posted via http://www.ruby-forum.com/ .
stomar
(stomar)
20 June 2012 21:35
2
Maybe this helps:
<Array slicing in Ruby: explanation for illogical behaviour (taken from Rubykoans.com) - Stack Overflow ;
Regards,
Marcus
···
Am 20.06.2012 23:27, schrieb John R.:
I cannot find an answer to this, and perhaps the answer is that "it is
what it is..." But perhaps someone can explain this for me.
If I have an array, thus:
a = [1, 2, 3, 4]
there are four elements in the array. The indexes are 0..3.
a[4,0] returns
a[5,0], however, returns nil
Both of these are outside the scope of the array, aren't they? I would
think they would return the same thing, either nil or the empty array.
--
<https://github.com/stomar/> ;
<http://www.rubygems.org/profiles/stomar/> ;
11142
(-- --)
20 June 2012 21:38
3
See this post for an explanation: http://www.ruby-forum.com/topic/1393096#990065
-- Matma Rex
stomar
(stomar)
21 June 2012 06:07
4
This behavior definitely should be documented in the Array class.
···
Am 20.06.2012 23:38, schrieb Bartosz Dziewoński:
See this post for an explanation: String/array slices - Ruby - Ruby-Forum
--
<https://github.com/stomar/> ;
<http://www.rubygems.org/profiles/stomar/> ;
It's always humbling when you realize other people have thought through complicated stuff before you.
Dave
···
On 06/20/2012 04:38 PM, Bartosz Dziewoński wrote:
See this post for an explanation: String/array slices - Ruby - Ruby-Forum
-- Matma Rex
stomar
(stomar)
22 June 2012 06:13
7
Is this obsolete:
<http://www.ruby-doc.org/documentation-guidelines.html> ; ?
Regards,
Marcus
···
Am 22.06.2012 00:56, schrieb Justin Collins:
On 06/20/2012 11:07 PM, sto.mar@web.de wrote:
...
This behavior definitely should be documented in the Array class.
Good idea. Here's how:
Ruby Documentation Project
--
<https://github.com/stomar/> ;
<http://www.rubygems.org/profiles/stomar/> ;
That site looks more specific to ruby-doc.org (e.g., using "stdlib-doc" to generate docs, instead of rdoc). I don't know if following those instructions will work or not. The instructions in the link I sent will.
-Justin
···
On 06/21/2012 11:13 PM, sto.mar@web.de wrote:
Am 22.06.2012 00:56, schrieb Justin Collins:
On 06/20/2012 11:07 PM, sto.mar@web.de wrote:
...
This behavior definitely should be documented in the Array class.
Good idea. Here's how:
Ruby Documentation Project
Is this obsolete:
<http://www.ruby-doc.org/documentation-guidelines.html> ; ?
Regards,
Marcus
stomar
(stomar)
1 July 2012 08:02
9
A late update: I submitted a patch for the documentation,
see <https://bugs.ruby-lang.org/issues/6680 >
···
--
<https://github.com/stomar/ >