$$ looks like a scalar but is a rank 1 array. use #$ instead.
,:`]@.(<:@#@$) fee=:'ab'

the verb
,:`]@.(<:@$^:2 fee) is reduced to  ]  and then run as ] fee
On Oct 3, 2015 8:27 AM, "Nollaig MacKenzie" <[email protected]>
wrote:

>
>
> I have a variable, fee, which might have shape
> N,2  or just 2.  I want a function that converts
> fee when it has shape 2 to shape 1 2.
>
> It seems straightforward: if the rank is 2,
> make no change, if 1, apply ,:
>
> So something like ,:`]@.(<:@$^:2) should
> do the trick. Indeed, this works:
>
>    $ ,:`]@.(<:@$^:2 fee) fee=:'ab'
>    1 3
>
> But when I try to define something to do
> what I want, I get lost.
>
>     ,:`]@.(<:@$^:2) fee=:'ab'
>     |rank error
>     |       ,:`]@.(<:@$^:2)fee=:'ab'
>         ,:`]@.(<:@$^:2 ]) fee=:'ab'
>         |domain error
>         |       ,:`]@.(<:@$^:2]) fee=:'ab'
>             ,:`]@.((<:@$^:2)@: ]) fee=:'ab'
>             |rank error
>             |       ,:`]@.((<:@$^:2)@:]) fee=:'ab'
>
>
>
>  (I'll spare you more)
>
>  I must be missing something obvious.
>
> --
> Nollaig MacKenzie
> http://www.yorku.ca/nollaig
> ----------------------------------------------------------------------
> 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