Loop over multiple arrays simultaneously: Difference between revisions

Content added Content deleted
No edit summary
Line 1,973: Line 1,973:


=={{header|J}}==
=={{header|J}}==
Since J's primitives are designed for handling what some programmers might think of as "an array monad" of arbitrary rank, a natural approach would be to concatenate the multiple arrays into a single array. In many cases we would already have done so to pass these arrays as an argument to some user defined routine. So, let's first see how that could look:
For arrays of different types:
For arrays of different types:
<syntaxhighlight lang="j"> ,.&:(":"0@>)/ 'abc' ; 'ABC' ; 1 2 3
<syntaxhighlight lang="j"> ,.&:(":"0@>)/ 'abc' ; 'ABC' ; 1 2 3