Tagged in ‘Ruby’

Binary search redux

I’m guessing you’ve heard of binary search. What you might not have heard about is a slightly different and more general formulation that leads to surprisingly elegant solutions for some problems.

Let’s implement Either

A fairly common programming scenario requires a series of steps to be performed where each step requires the output of the previous one as its input. Let’s take a look how that can be solved with a technique inspired by functional programming.