Skip to content

Instantly share code, notes, and snippets.

@DataKinds
Last active August 29, 2015 14:10
Show Gist options
  • Save DataKinds/11d9281c8b9026c4acbe to your computer and use it in GitHub Desktop.
Save DataKinds/11d9281c8b9026c4acbe to your computer and use it in GitHub Desktop.
Codegolfed Mandelbrot Renderer
import Data.Complex
import Data.List
main=let(q,w,e,r,t,y,u)=(-2,1,0.01,-1.25,1.25,0.01,9)in writeFile"m.pgm"(("P2\n"++(show$length[q,(q+e)..w])++" "++(show$length[t,(t-y)..r])++"\n1\n")++((unlines.map(unwords.map(unwords.map show)))$((map.map)(\x->if x==(-1)then[0]else[x]))((map.map)(\c->(\c->if(magnitude$((iterate((\b a->a^2+b)c)(0:+0))!!u))>2then-1else 1)c)[[a:+b|a<-[q,(q+e)..w]]|b <-[t,(t-y)..r]])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment