Get the latest tech news

A Curried Composition Puzzle


In this short post, I'd just like to share a little puzzle that I assigned as an exericse while TAing for a functional programming class last spring. It's a cute problem, but it haunts me.

In this short post, I'd just like to share a little puzzle that I assigned as an exericse while TAing for a functional programming class last spring. The strangest thing is that when I discarded all of my intuition about functions and composition, and turned this into a purely algebraic problem about rearranging binary trees according to a mechnical rewriting rule, it suddenly became much more manageable. The above solution is still pretty unintuitive to me, in the sense that I haven't found a way of ascribing meaning to it on a deeper level than "the algebra just works out".

Get the Android app

Or read this on Hacker News