V
Vivek
I have the below sample program.
a=[1,2,3,1]
b=[1,[2,4],[5,6,3],4]
b.flatten!
a.push b
a.uniq!
puts a
The output it produces is
1
2
3
1
2
4
5
6
3
4
a.uniq! doesnt seem to work on the array created after appending the
flattened b array to a.
Note that uniq! has actually purged the last element '1' in the
original array a.It looks like
uniq! somehow still works on the old array a and is not aware of the
new array.
I am using 1.8.4
Vivek
a=[1,2,3,1]
b=[1,[2,4],[5,6,3],4]
b.flatten!
a.push b
a.uniq!
puts a
The output it produces is
1
2
3
1
2
4
5
6
3
4
a.uniq! doesnt seem to work on the array created after appending the
flattened b array to a.
Note that uniq! has actually purged the last element '1' in the
original array a.It looks like
uniq! somehow still works on the old array a and is not aware of the
new array.
I am using 1.8.4
Vivek