RosettaCodeData/Task/Mandelbrot-set/Haskell/mandelbrot-set.hs
2019-09-12 10:33:56 -07:00

15 lines
333 B
Haskell

import Data.Bool
import Data.Complex (Complex((:+)), magnitude)
mandelbrot
:: RealFloat a
=> Complex a -> Complex a
mandelbrot a = iterate ((a +) . (^ 2)) 0 !! 50
main :: IO ()
main =
mapM_
putStrLn
[ [ bool ' ' '*' (2 > magnitude (mandelbrot (x :+ y)))
| x <- [-2,-1.9685 .. 0.5] ]
| y <- [1,0.95 .. -1] ]