From: Jim Freeze Date: 2001-04-25T00:31:04+09:00 Subject: [ruby-talk:14154] array#flatten! question Hello. Does anyone know why flatten! would complain about recursion and flatten not. Here is what I tried: ruby 1.6.3 (2001-03-19) [sparc-solaris2.6] irb(main):001:0> a = [1,2,3] [1, 2, 3] irb(main):002:0> b = [4,5,6] [4, 5, 6] irb(main):003:0> c = [] [] irb(main):004:0> c << a << b [[1, 2, 3], [4, 5, 6]] irb(main):005:0> c[0] = b [4, 5, 6] irb(main):006:0> c [[4, 5, 6], [4, 5, 6]] irb(main):007:0> c.flatten! # => why the complaint here? ArgumentError: tried to flatten recursive array (irb):7:in `flatten!' (irb):7:in `irb_binding' irb(main):008:0> c.flatten # => no complaint here [4, 5, 6, 4, 5, 6] irb(main):009:0> Thanks ========================================================= Jim Freeze jim@freeze.org --------------------------------------------------------- No comment at this time. http://www.freeze.org =========================================================