Project

General

Profile

Actions

Bug #1367

closed

flatten(0) is not consistent with flatten(), flatten(1), etc.

Added by pjlewis (Paul Lewis) about 15 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
Backport:
[ruby-core:23168]

Description

=begin

a = [1, 2]
a2 = a.flatten
a2 << :a
a2
=> [1, 2, :a]
a
=> [1, 2]

b = [3, 4]
b2 = b.flatten 1
b2 << :b
b2
=> [3, 4, :b]
b
=> [3, 4]

HOWEVER:

c = [5, 6]
c2 = c.flatten 0
c2 << :c
c2
=> [5, 6, :c]
c
=> [5, 6, :c] <-- Huh? Should be [5, 6].
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0