Worth recalling when comparing J with APL is that
the 'From {' primitive is an improvement over the semi-colon
notation.
http://www.jsoftware.com/help/dictionary/d520.htm
There is more material about { but I cant find
it on the jsoftware site.

In the context of this thread and given
ARRAY=. i.11 12 13 14
N=.3
M=.2
Then the expressions
 (<(-N){.!.(<a:)(<,1)){ARRAY  NB. (A)
 (<(-M){.!.(<a:)(<,1)){ARRAY  NB. (B)
are, by way of demonstration, equivalent to
ARRAY[;;,1;]
ARRAY[;,1;;]

A simple utility could be:
V =. 2 : '(<(-m){.!.(<a:)(<,n)){ y'
so that
A <-> 3 V 1 ARRAY
B <-> 2 V 1 ARRAY

David
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to