Monday 2019-06-24

Tristan Hume has a post comparing the writing of compilers by students using rust, haskell, ocaml, scala, c++, and python. He wanted to make a post about language contrast -- however the differentiator ended up being the design choices.

Part of the difficulty of some problems is that the approach you choose in the beginning either lets you run free or it puts you into a bog. For example, the following problem is either 10 lines or pages of code depending on whether metaprogramming is used or not.

Insert + or - signs anywhere between the digits 123456789 in such a way that the expression evaluates to 100. The order of the digits must not be changed.

Sample solution: 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100

Programming problem: Write a program to output all solutions.

-- flaps (ajr)

We know we are in trouble when we can only see one solution. And we need practice quickly ascertaining whether the path ahead runs into a malarial swamp or a broad clear plain that leads us to our destination.