An order-5 approximation to the space-filling Hilbert curve.
import Diagrams.Backend.SVG.CmdLine
{-# LANGUAGE NoMonomorphismRestriction #-}
import Diagrams.Prelude
0 = mempty
hilbert = hilbert' (n-1) # reflectY <> vrule 1
hilbert n <> hilbert (n-1) <> hrule 1
<> hilbert (n-1) <> vrule (-1)
<> hilbert' (n-1) # reflectX
where
= hilbert m # rotateBy (1/4)
hilbert' m
= frame 1 . lw medium . lc darkred
example . strokeT $ hilbert 5
= mainWith (example :: Diagram B) main