fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 196: Pass a sub-array
Idiom # 196: Pass a sub-array
See
programming-idioms.org
:
Code
# fuzion arrays are immutable, we need to use mutate.array instead n := 20 m := 13 foo (a container.Mutable_Array i32, i i32) => a[i] := 42 mi : mutate is mi.instate_self ()-> a := (mi.array i32).new mi n 0 a.indices ! i -> a[i] := i (1..m : 2) ! i -> foo a i
What are effects?
Running Example
ex196 is n i64 := 20 m i64 := 13 foo (E type : effect, a container.Mutable_Array i64 E, i i64) => a[i] := 42 mi : mutate is mi.instate_self ()-> a := (mi.array i64).new mi n 0 a.indices ! i -> a[i] := i say a ((i64 1)..m : 2) ! i -> foo a i say a
What are effects?
last changed: 2024-07-01
next: NYI: Idiom # 197: Get a list of lines from a file