Hacker News new | ask | show | jobs
by phoronixrly 1283 days ago
First, it's an exercise, you don't get to use much of this functionality day to day, at least if you're a lowly webdev :(.

Second, the solution is optimized for speed of writing (you get more points in AOC the quicker you submit the solution), not for readability. I try to get the chain of calls in my Ruby REPL as soon as the challenge drops.

Third, if you so wish to debug this chain of calls, you can insert a breakpoint and get a REPL anywhere in it with Object#tap:

   foo.bar(3).tap { |chain| binding.irb }.baz { |larodi| larodi + 5 }
And lastly, it becomes second nature to read and write these.