🌉 bridged from @isti115@lemmy.world by Tidepool
isti115
@isti115.lemmy.world.ap.tdpl.io
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- Edit: They're back!
What happened to stories?
I just logged in today and found that all stories seem to be gone from my path and the practice hub as well. 🙁 I really hope that this is only something temporary! ——— Edit: I just checked after about ~10 hours and they seem to have returned!
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?)
Has anyone seen one of these before?
I remember that way back around 2015 the double XP boost used to stack, so you could get a 4x multiplier, but I don't think that I've ever got a triple.