[Jprogramming] indirect assignment and rank question
bob therriault
bobtherriault at mac.com
Sat Dec 8 01:27:25 UTC 2012
Good question Linda,
My preference, if you did not need to assign variables, would be to just use the N V V train and so the verb test becomes
t=:((2 0 1|:])-:(0 1|:]))@:?
and you could apply it to any noun you would like.
t 3 2 4$5
1
The right inner brackets are not necessary, but I think that they help show the comparison that is taking place a bit more clearly.
Cheers, bob
On 2012-12-07, at 4:56 PM, Linda Alvord wrote:
> Why is it necessary to include & in each of these example?
>
> (0 1&|:A)-:0 1|:A=:?3 2 4$5
> 1
> (2 0 1|:A)-:0 1|:A
> 1
> (0 1 2|:B)-:3 0 1 2|:B=:?3 2 5 4$5
> 1
>
> (0 1 2&|:B)-:3 0 1 2&|:B=:?3 2 5 4$5
> 1
>
>
> Linda
>
> -----Original Message-----
> From: programming-bounces at forums.jsoftware.com
> [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of Dan Bron
> Sent: Friday, December 07, 2012 6:05 PM
> To: programming at jsoftware.com
> Cc: programming at jsoftware.com
> Subject: Re: [Jprogramming] indirect assignment and rank question
>
> Something I never wrapped my head around with |: is what exactly the DoJ
> means when it says axes are "run together" when the LHA is boxed.
>
> -Dan
>
>
> On Dec 7, 2012, at 3:28 PM, Marshall Lochbaum <mwlochbaum at gmail.com> wrote:
>
>> 0 1 2&|: will do the job.
>>
>> I recommend reading the dictionary definition of |: through a few times.
>> In particular, note that 0 1&|: on a rank three array is the same as
>> 2 0 1&|: , and 0 1 2&|: turns into 3 0 1 2&|: on a rank four array.
>>
>> Marshall
>>
>> On Fri, Dec 07, 2012 at 03:02:49PM -0500, Brian Schott wrote:
>>> I am working with photographic images which use RGB color.
>>> The array d is a single image and the array D is now 2 images but I
>>> want D to contain any number of images. And I want split out the R,G,
>>> and B part which I can do for d, but I am having difficulty with the
>>> analogous r, g, and b for D.
>>>
>>> $d
>>> 50 50 3
>>> $D
>>> 2 50 50 3
>>>
>>> 'R G B'=: 0 1|: d
>>> $G
>>> 50 50
>>>
>>> What is the mysteryverb that will produce ($g)-:2 50 50 in the
>>> following expression?
>>> 'r g b'=: mysteryverb D
>>>
>>> Thanks,
>>>
>>> (B=)
>>> ---------------------------------------------------------------------
>>> - For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list