You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be some built-in syntax to create dynamically create vector values (both mutable and immutable) of a given size. Creating large contiguous arrays is a commonplace operation in low-level programming, and users should not have to use a library function or macro to do it. The syntax used in the following examples is not optimal for a few reasons, but illustrates the point.
For example, to create a vector of zeroes that is 20 elements long, you could use the single expressions:
@[0, ...20];
@[mut 0, ...20];
The following function would create a vector that is count elements long, and every element has value t:
This syntax could support interleaving of multiple values as well. The following function would create a vector that is count elements long, which alternates between the values t1 and t2:
There should be some built-in syntax to create dynamically create vector values (both mutable and immutable) of a given size. Creating large contiguous arrays is a commonplace operation in low-level programming, and users should not have to use a library function or macro to do it. The syntax used in the following examples is not optimal for a few reasons, but illustrates the point.
For example, to create a vector of zeroes that is 20 elements long, you could use the single expressions:
The following function would create a vector that is
count
elements long, and every element has valuet
:This syntax could support interleaving of multiple values as well. The following function would create a vector that is
count
elements long, which alternates between the valuest1
andt2
:The text was updated successfully, but these errors were encountered: