Einar Høst
Einar W. Høst is a software developer at NRK, the Norwegian public broadcaster. He enjoys domain modelling, API design and computer programming. In his spare time he dabbles in impractical coding projects aimed at having fun with the djinns of the computer. He has a PhD in Computer Science from the University of Oslo and used to be a software craftsman.
unfold_lessunfold_more Escher in Elm: Picture combinators and recursive fish
Key takeaways
- Learn to love functional concepts like composition and recursion.
- Appreciate the power and elegance of abstractions that compose.
- Become friends with Elm, a functional programming language for the browser.
This is a live coding session based on a classic 1982 paper by Peter Henderson. Although the paper is old, the ideas in it remain fresh, practical and relevant to software development today. It demonstrates the power and beauty of functional abstraction and composition. Following in Henderson's footsteps, I will show the decomposition and reconstruction of Escher's woodcutting "Square Limit", a beautiful recursive tessellation of interleaving fish, using functional programming. To do so, I will define a small set of functions that operate on pictures - transforming them and composing them into more complex pictures. With these functions implemented, I will create a replica of Escher's Square Limit as an SVG. I will use Elm as the implementation language, because Elm is simple, friendly and runs in the browser.