First they Came for the Goreans

I’m not a member of the Drupal Community. I’ve made a couple of Drupal sites and written one or two private-use Drupal modules, but I’ve never contributed any code or attended any conferences. I have been following the big dustup with some interest, though – because I increasingly think this is the issue of the…

Converging to Point Free

As mentioned before, I’m a big fan of the RamdaJS library. It doesn’t get you as close to Haskell as Purescript (which arguably even takes you beyond Haskell), but when your dayjob requires Javascript, it’s often the next best thing. One pattern that seems to come up a lot at work is a pattern where…

Application and Composition

Haskell‘s notorious learning curve isn’t just down to the apparent need to learn advanced Category Theory before you can cogently browse the documentation. It’s also that you’re hit with a syntax that’s really unfamiliar – at least if you’re coming from the more "mainstream" languages like I am (Python, C++, Coffeescript). In particular, you’re hit…

Double Dabble Ramda

Recently at work I’ve switched from using Lodash to Ramda for functional programming extensions to Javascript/Coffeescript and I’m happier than I’ve pretty much ever been. Ramda isn’t the Javascript Holy Grail – that honor, I’m guessing, goes to PureScript – very much next in line on the list of things to learn – but it…

Understanding Applied to Double Dabble

Understanding is a funny thing. Sometimes you can trick yourself into thinking you understand something you really don’t. But most times you kinda sorta know that you don’t fully understand it, and I’m just not really sure how that works. In particular, there are two kinds of levels to "understanding." There’s that level where you…

Number System Solution

Yesterday I used a programming challenge to illustrate a use of generators. The solution to the problem given in that post was far from ideal – just a brute force hack, really. Today, let’s look at a respectable solution to the problem. Again, the problem: Imagine you are given a set of weights, each weight…

When Generators Are Brute Force Enablers

An interesting (if mysterious) programming challenge popped up in my business partner’s browser the other day. You’re given an odd set of weights which represents the series of powers of three. So, the first one is 1lb, the second 3lbs, the third 9lbs, the fourth 27lbs, etc. You also have a scale. If someone puts…

Path to Y – Y

Last time we got two important steps closer to implementing the Y Combinator in C++: How to enforce "composition" on every call – by overloading the call operator, delegating its functionality to our call member function, but only after calling compose How to pull responsibility for making our FactorialWrapper class recursive out of the class…

Path to Y – Overloading

Last time, we’d found a way to (sort of) ape function composition in C++ by using Functors … modeled as classes that bundle the function to-be-made-recursive with a private member pointer to itself. The class exposess two public methods – compose and call – which are meant to correspond to the two stages that a…

Path to Y – Shallow Composition

Last time we saw how to pass "build" functions (i.e. return a function from a function that depends on the arguments passed to the outer function) in C++, even though C++ functions don’t really "do that." The trick is to wrap the return function in a class that can set private member variables which are…