fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 195: Pass a two-dimensional array
Idiom # 195: Pass a two-dimensional array
See
programming-idioms.org
:
Code
foo a foo (a array2 f64) unit => say "array size {a.length0}×{a.length1}" for s := 0.0, s + v * (i.as_f64 + 1) * (j.as_f64 + 1) # NYI syntax sugar for tuples not supported, should be # # (i,j,v) in a.enumerate2 e in a.enumerate2 i := e.0 j := e.1 v := e.2 else say "sum is $s"
What are effects?
Running Example
ex195 is arr := array2 5 7 i,j->3.14 foo arr foo (a array2 f64) unit => say "array size {a.length0}×{a.length1}" for s := 0.0, s + v * (i.as_f64 + 1) * (j.as_f64 + 1) # NYI syntax sugar for tuples not supported, should be # # (i,j,v) in a.enumerate2 e in a.enumerate2 i := e.0 j := e.1 v := e.2 else say "sum is $s"
What are effects?
last changed: 2024-07-01
next: Idiom # 196: Pass a sub-array