Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
appendsEx k n c = appends c (zip (iterateN n (rotateBy (1/(fromIntegral k))) unitX) (repeat circ))
circ = (circle 1 # fc red # lc white # lwL 0.25)
sides = 6
create :: Int -> Diagram B
create n = (create' (n - 1) sides circ) <> strut 30 where
create' n k sofar | n <= k = appendsEx k n sofar
create' n k sofar = create' (n - k) (k + sides) (appendsEx k k sofar)
myCircle :: [(String, Diagram B)]
myCircle = zip (map show [1..100]) (map create [1..100])
main :: IO ()
main = mainWith myCircle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment