fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 179: Get center of a rectangle
Idiom # 179: Get center of a rectangle
See
programming-idioms.org
:
Code
point (x, y f64) is redef as_string => "($x, $y)" rectangle(a, b point) is center => point (a.x+b.x)/2 (a.y+b.y)/2 x1 := 0.0 x2 := 1.0 y1 := 0.0 y2 := 2.0 r := rectangle (point x1 y1) (point x2 y2) c := r.center
What are effects?
Running Example
ex179 is point (x, y f64) is redef as_string => "($x, $y)" rectangle(a, b point) is center => point (a.x+b.x)/2 (a.y+b.y)/2 x1 := 0.0 x2 := 1.0 y1 := 0.0 y2 := 2.0 r := rectangle (point x1 y1) (point x2 y2) c := r.center say c
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 180: List files in directory