fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 314: Fill array with value
Idiom # 314: Fill array with value
See
programming-idioms.org
:
Immutable Arrays
Code
Code input
x1 := x.map_to_array _->v
What are effects?
Runnable Example
Code input
ex314 is # Arrays in Fuzion are immutable, creating a new array instead x := [1,2,3,4,5] v := 0 x1 := x.map_to_array _->v say x say x1
What are effects?
Using mutate effect
Runnable Example
Code input
ex314a is # Using mutate.array T, creating a new effect mi which inherits from mutate # elements of this array can be mutated while the effect is installed mi : mutate is mi.instate_self ()-> x := (mi.array i64).new 5 42 say x for e in x i i64 := 0, i + 1 do x[i] := 0 say x
What are effects?
last changed: 2026-02-20
next: Idiom # 315: Memoization