An order-5 approximation to the space-filling Hilbert curve.

Author: John Tromp

Download raw source code

> {-# LANGUAGE NoMonomorphismRestriction #-}
> import Diagrams.Prelude
> 
> hilbert = iterate expand mempty where
>   expand t = alignBL $ hcat [u, hrule 1, reflectX u] where
>              u = vcat [t, alignT $ vrule 1, rotateBy (3/4) t]
> 
> example = pad 1.1 . centerXY $ hilbert!!5