Assuming you want all fills to come before the corresponding element,
you can use:

   1j2 #&.|. data
  a  b  r  a  c  a  d  a  b  r  a

I agree that fill-before is a reasonable interpretation for a negative
imaginary part, although I doubt J's complex replicate, or APL's expand,
are really the best way to deal with inserting fills (I don't have a
better one).

Marshall

On Sat, Feb 01, 2020 at 11:46:24AM -0500, David Lambert wrote:
>    data=:'abracadabra'
> 
>    NB. whereas
>    1j_2 # data
> |domain error
> |   1j_2    #data
> 
>    NB. I've often wanted
>    _2 |. 1j2 # data
>   a  b  r  a  c  a  d  a  b  r  a
> 
>    NB. because it aligns with
> 
>    3 ": i.~ data                      NB. index from left
>   0  1  2  0  4  0  6  0  1  2  0
> 
>    3 ": i:~ data                      NB. index from right
>  10  8  9 10  4 10  6 10  8  9 10
> 
>    duplicate =: (i: ~: i.)~
>    duplicate data
> 1 1 1 1 0 1 0 1 1 1 1
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to