I would write the original as:

   z ([ #~ 0 1 0 -:"1 {) 1 0 1 0 1 0
3 4 5

​Then to reverse the arguments you could do one of the following:
    1 0 1 0 1 0 ([ #~ 0 1 0 -:"1 {)~ z

3 4 5

    1 0 1 0 1 0 (] #~ 0 1 0 -:"1 {~) z

3 4 5




On Sun, Jun 4, 2017 at 1:45 PM, Michael Rice <[email protected]> wrote:

>    z =: 2 3 $ i.6
>    z
> 0 1 2
> 3 4 5
>    z { 1 0 1 0 1 0
> 1 0 1
> 0 1 0
>    (-: & 0 1 0) z { 1 0 1 0 1 0
> 0
>    (-: & 0 1 0)"1 z { 1 0 1 0 1 0
> 0 1
>    ((-: & 0 1 0)"1 z { 1 0 1 0 1 0) # z
> 3 4 5
>    z #~ ((-: & 0 1 0)"1 z { 1 0 1 0 1 0)
> 3 4 5
>    z #~ ((-: & 0 1 0)"1 (1 0 1 0 1 0 {~ z))
> 3 4 5
>    z #~ ((-: & 0 1 0)"1 ({~ & z) 1 0 1 0 1 0)
> 3 4 5
>    z (#~ ((-: & 0 1 0)"1 @: ({~ & z))) 1 0 1 0 1 0
> 3 4 5
>
> Now write the function so the left paramenter is 1 0 1 0 1 0
> and the right parameter is z
>
>    ((-: & 0 1 0)"1 @: ({~ & z) 1 0 1 0 1 0) # z
> 3 4 5
>
>    1 0 1 0 1 0 (# ((-: & 0 1 0)"1 @: ({~ & z))) z
> |index error
> |   1 0 1 0 1 0    (#((-:&0 1 0)"1@:({~&z)))z
>
>    (1 0 1 0 1 0) (# ((-: & 0 1 0)"1 @: ({~ & z))) z
> |index error
> |   (1 0 1 0 1 0)    (#((-:&0 1 0)"1@:({~&z)))z
>
>    1 0 1 0 1 0 (# (({~ & z) @:~ (-: & 0 1 0)"1))) z
> |syntax error
> |   1 0 1 0 1 0(#(    ({~&z)@:~(-:&0 1 0)"1)))z
>
>    (1 0 1 0 1 0) (# (({~ & z) @:~ (-: & 0 1 0)"1))) z
> |syntax error
> |   (1 0 1 0 1 0)(#(    ({~&z)@:~(-:&0 1 0)"1)))z
>
> How would it be written?
> ----------------------------------------------------------------------
> 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