fuzion-lang.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) => max_escape_iterations = 0 || z.abs² <= 4 && is_in_mandelbrot_set c max_escape_iterations-1 z*z+c steps(start, step f64) => start : steps start+step step mandelbrot_image(y_start, y_step, x_start, x_step f64, height, width i32) => for _ in 1..height; y in steps y_start y_step do for _ in 1..width; x in steps x_start x_step 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?
last changed: 2024-06-28
next: Rosetta Code Faulhaber Example