Ben Gorte wrote:
> I use an adverb called ins that behaves like } , except that it inserts :)

In the argument to the adverb, does 1 ins refer to the item at index 1 in
the argument, or the empty space between item 1 and item 2, or the empty
space between item 0 and item 1, or what?

If I recall correctly, in APL, you can use fractional indices to specify
inserting along a new axis, so 'hello' ,[0.5] '-' would be equivalent to
J's 'hello' ,: '-' and 'hello' ,[1.5] '-' would be 'hello' ,. '-'
(assuming []IO<-1 in the APL).

Maybe it's worth including an ins-like adverb in the stdlib which follows
this convention (fractional indices refer to the lacunae between items)?

-Dan

PS:  Looks like Dyalog, at least, supports fraction axes; see p. 236 of
their user guide (Chapter 4, "Catenate/Laminate", Section 2.15.2
"Lamination with Fractional Axis Specification"):

http://docs.dyalog.com/13.1/Dyalog%20APL%20Programmer's%20Guide%20&%20Language%20Reference.pdf


Lamination with Fractional Axis Specification
---------------------------------------------

The arrays X and Y are joined along a new axis created before 
the {ceil}Kth axis.  The new axis has a length of 2.  K must exceed 
[]IO (the index origin) minus 1, and K must be less than []IO plus 
the greater of the ranks of X and Y.  A scalar or unit vector argument 
is extended to the shape of the other argument.  Otherwise X and Y 
must have the same shape. The rank of R is one plus the greater of
the ranks of X and Y.


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

Reply via email to