[Jprogramming] problem using ,:`]@.
Nollaig MacKenzie
nollaig at amhuinnsuidhe.net
Sat Oct 3 04:28:26 UTC 2015
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" <nollaig at amhuinnsuidhe.net>
> 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
More information about the Programming
mailing list