Ah. I think I might have got to this if I
hadn't fallen for the cuteness of $^:2  :-)

Thanks!

On 2015.10.03 09:28:24, you,
 the extraordinary bill lam, spake thus:

> $$ 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

        <snip!>
-- 
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to