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 Mutable_Array i32, i i32) => a[i] := 42 mi : mutate is mi.go ()-> a := (mi.array i32).type.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 := 20 m := 13 foo (a Mutable_Array i32, i i32) => a[i] := 42 mi : mutate is mi.go ()-> a := (mi.array i32).type.new mi n 0 a.indices ! i -> a[i] := i say a (1..m : 2) ! i -> foo a i say a
What are effects?
next: NYI: Idiom # 197: Get a list of lines from a file