Skip Navigation

isti115

@isti115.lemmy.world.ap.tdpl.io

5 Posts0 Comments0 Memberships

Joined November 2026

  • Tail Call Optimization

    I wasn't able to find any up-to-date information about tail call optimization support in Ruby, so I decided to post this hoping that it will pop up next time someone might also be searching for this topic... What I was able to figure out is that TCO can be enabled in Ruby 3.4 via a compile option like so:

     ruby
    RubyVM::InstructionSequence.compile_option = {tailcall_optimization: true}
    
    def tailSumUntil(n, m)
      n == 0 ? m : tailSumUntil(n - 1, n + m)
    end
    
    tailSumUntil(100_000_000, 0)
    # => 5000000050000000
  • 2024 / DAY 01 - Solutions

    Feel free to share your solutions or browse others' for inspiration! Please tag your comments with the language you solved in to make it easier to search for specific languages in case we happen to get more comments than expected. 😀 I really hope that we can create some discussion here to liven up this community!

  • Has there ever been a problem that involved numbers other than integers?

    In preparation for this year's event I started to create a utility library and realized that I might not even need to care about decimal, or even fractional numbers, as I don't remember ever encountering them while solving a problem so far. Does anyone have any examples for problems which required using floating point calculations? Is it maybe even explicitly stated that they are not needed? (I remember that Google Code Jam had some statistical problems where the solution didn't have to be exact, just within an acceptable error margin, but that isn't likely to happen here, right?)