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
Now that we have higher order functions we can support functions like map and fold for arrays which lessens the need for repetitive for loops.
Solution
Add these functions to the std::array module. Note that because we cannot dynamically grow arrays the only way to produce a new array of type [T; N] would be to take an existing element of the original array and replicate it N times, then mutate from there. This assumes the original array is of at least length 1. This should be a fine assumption currently as we assume all arrays are non-empty still.
The text was updated successfully, but these errors were encountered:
Problem
Now that we have higher order functions we can support functions like
map
andfold
for arrays which lessens the need for repetitive for loops.Solution
Add these functions to the
std::array
module. Note that because we cannot dynamically grow arrays the only way to produce a new array of type[T; N]
would be to take an existing element of the original array and replicate itN
times, then mutate from there. This assumes the original array is of at least length 1. This should be a fine assumption currently as we assume all arrays are non-empty still.The text was updated successfully, but these errors were encountered: