Created
July 17, 2019 09:21
-
-
Save yellowflash/2752f32c3cb37d064d54d683fbe3ab88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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