Images, snippets, snapshots, math

View Gabriele Lami's profile on LinkedIn

giovedì 20 agosto 2009

re: Mandelbrot Set in Haskell

import Data.Complex


conv p=(\n->".,:;|!([$O0*%#@?"!!(n-1))(ceiling (p*8)::Int)
gr=map(\y->[(x:+y)|x<-[-2,-1.97..0.7]])[-1.2,-1.13..1.2]
--px w=magnitude(foldl1(\z c ->z^2 +c)(replicate 10 w))
px w=(magnitude.last.take 10.takeWhile(\r->(magnitude r )<6).iterate(\z->z^2+w))w
image=map((map(\el->case(px el<2)of{true->conv(px el);_->' '})))gr
main=mapM_ putStrLn image


mandelbrot haskell ascii-art
better...

Nessun commento: