Nate Dalo

October 24, 2025

Advent of Code, Ruby, and Object-Oriented Design

Advent of Code is a yearly programming challenge that’s a great way to keep your skills sharp. You can solve problems from past years at any time, which makes it a perfect ongoing exercise. To get the most out of it, I like to turn off anything in my editor that might give me hints or shortcuts. That means no Copilot, and even no synta...
Read more
February 5, 2025

Ruby's "spaceship" operator <=> and the Comparable mixin

Ruby's "spaceship" operator (<=>), AKA the three-way comparison operator, lets you compare two values. If the value on the left-hand side is less than the value on the right-hand side, it will return -1; if the value is greater, it will return 1; and if the values are the same, it will return 0: 1 <=> 2 # => -1 2 <=> 1 # => 1 1 <=> 1 #...
Read more
February 4, 2025

Conversion Functions in Ruby

In Ruby, a conversion function converts to the type indicated by the function name, if possible. Technically, it is a method on the Kernel class, but it starts with a capital letter and is used like a function. Integer("1") # => 1 Float("3.14") # => 3.14 Why would you use this over the more common methods such as to_i and to_f? One rea...
Read more