If []IO is 1 your APL expression expands each row, not each column, it
inserts columns of 0s

On Fri, 19 May 2006, Dan Bron wrote:

> I don't have access to the paper, but assuming:
>
>    BV    is  a boolean vector
>    Z     is  a rank 2 array
>    \     is  the scan/expand symbol
>    []IO  is  1
>
> Then the expression   BV \[2] Z  expands Z.  That is, it inserts a fill row 
> (all spaces) in  Z  at each  0  in BV.  The mnemonic is  \  (expand) is "the 
> opposite" of  /  (compress).  Similarly, in J, the equivalent is:
>
>             BV #^:_1 Z
>
>          1 0 1 #^:_1 >;:'Howdy pardner'
>       Howdy
>
>       pardner
>
> another option is:
>
>             BV (#~ ] (1 j.#);._1~ 1: 0} ])~ Z
>
>          1 0 1 (#~ ] (1 j.#);._1~ 1: 0} ])~ > ;:'Howdy pardner'
>       Howdy
>
>       pardner
>
> I'm not really sure when it's better to use  #^:_1  with a boolean LHA vs  #  
> with a complex LHA.
>
> -Dan
>
>
> ----------------------------------------------------------------------
> 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