fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 208: Formula with arrays
Idiom # 208: Formula with arrays
See
programming-idioms.org
:
Code
# since arrays are immutable, we create and initialize a new array: # a := array a.length (i -> e * (a[i] + b[i] * c[i] + f64.type.cos d[i]))
What are effects?
Running Example
a := [1.0, 2.0, 3.0] b := [0.1, 0.2, 0.3] c := [1.1, 2.2, 3.3] d := [0.2, 0.4, 0.6] e := 3.1416 arr := array a.length (i -> e * (a[i] + b[i] * c[i] + f64.type.cos d[i])) say arr
What are effects?
last changed: 2024-07-01
next: Idiom # 209: Type with automatic deep deallocation