fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 268: User-defined operator
Idiom # 268: User-defined operator
See
programming-idioms.org
:
Code
vector (x, y, z f64) is infix ⨯ (other vector) vector => vector (vector.this.y*other.z - vector.this.z*other.y) (vector.this.z*other.x - vector.this.x*other.z) (vector.this.x*other.y - vector.this.y*other.x)
What are effects?
Running Example
ex268 is vector (x, y, z f64) is infix ⨯ (other vector) vector => vector (vector.this.y*other.z - vector.this.z*other.y) (vector.this.z*other.x - vector.this.x*other.z) (vector.this.x*other.y - vector.this.y*other.x) redef as_string => "($x, $y, $z)" a := vector 1 0 0 b := vector 0 1 0 say a⨯b
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 269: Enum to String