LoginSignup
14
13

More than 5 years have passed since last update.

Hash[*array] は数が多すぎるとスタックオーバーフローになる

Posted at
irb(main):001:0> RUBY_VERSION
=> "2.0.0"
irb(main):002:0> Hash[*((0..100001).to_a)];nil
=> nil
irb(main):003:0> Hash[*((0..1000001).to_a)];nil
SystemStackError: stack level too deep
        from /Users/yuichi-tateno/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/irb/workspace.rb:86
Maybe IRB bug!

oh

14
13
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13