3 ms·
It would be a lot like that. There's a mindset shift to thinking of arrays as geometric objects to manipulate in space instead of as boundaries on valid indices
by kd0amg 6y ago
It would be a lot like that. There's a mindset shift to thinking of arrays as geometric objects to manipulate in space instead of as boundaries on valid indices. One of my favorite examples is computing a moving average over some vector of input data. Instead of thinking about looping over each sub-range to find its average, and having that nested inside a loop over possible sub-ranges, you can build a 2D array whose rows are time-shifted versions of the original 1D array. Sum that column-wise and divide by the number of rows to get your answer.
Understanding how you can build that iteration space as reified data gives you a lot more expressive power than you get from remembering that `|.` means "rotate." It's easy to look up which symbol corresponds to a chosen operation (and you'll memorize the ones you use a lot anyhow).