flang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Fuzion Examples
•
Rosetta Code Mandelbrot Set Example
Rosetta Code Mandelbrot Set Example
From
rosettacode.org
:
The following code draws the famous mandelbrot set.
Code Example
mandelbrotexample is isInMandelbrotSet(c complex f64, maxEscapeIterations i32, z complex f64) bool is maxEscapeIterations = 0 || z.abs² <= 4 && isInMandelbrotSet c maxEscapeIterations-1 z*z+c steps(start, step f64, numPixels i32) => array numPixels (i -> start + i.as_f64 * step) mandelbrotImage(yStart, yStep, xStart, xStep f64, height, width i32) => for y in steps yStart yStep height do for x in steps xStart xStep width do if isInMandelbrotSet (complex x y) 50 (complex 0.0 0.0) yak "⬤" else yak " " say "" mandelbrotImage 1 -0.05 -2 0.0315 40 80
What are effects?
next: Rosetta Code Faulhaber Example