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 is_in_mandelbrot_set(c num.complex f64, max_escape_iterations i32, z num.complex f64) bool is max_escape_iterations = 0 || z.abs² <= 4 && is_in_mandelbrot_set c max_escape_iterations-1 z*z+c steps(start, step f64, num_pixels i32) => array num_pixels (i -> start + i.as_f64 * step) mandelbrot_image(y_start, y_step, x_start, x_step f64, height, width i32) => for y in steps y_start y_step height do for x in steps x_start x_step width do if is_in_mandelbrot_set (num.complex x y) 50 (num.complex 0.0 0.0) yak "⬤" else yak " " say "" mandelbrot_image 1 -0.05 -2 0.0315 40 80
What are effects?
next: Rosetta Code Faulhaber Example