[Jprogramming] unexpected behaviour with rank of x:

'robert therriault' via Programming programming at jsoftware.com
Thu Nov 1 19:25:12 UTC 2018


Yep got it. I was overlooking the fact that J matches the arguments and you need to use / (Table) to apply atoms of the left argument to all of the atoms of the right argument
 1 2 x:"0 [ 3 4 NB. applies 1 x: 3 and 2 x: 4
3 0
4 1
 1 2 x:"0 [ 3 NB. applies 1 x: 3 and 2 x: 3
3 0
3 1
I haven't made that mistake for a while, but it does remind me that there are very simple rules which, when forgotten, really leave you in the dust. It is refreshing to visit beginners mind!
Thanks for the prodding.
Cheers, bob
> On Nov 1, 2018, at 12:02 PM, Brian Schott <schott.brian at gmail.com> wrote:
>> Bob,
>> "0 behaves like "0 0 on dyadic verbs.
>> On Thu, Nov 1, 2018 at 2:48 PM 'robert therriault' via Programming <
> programming at jsoftware.com> wrote:
>>> Any ideas on why I am getting this result? I am running the current
>> version of j807 but this seems to be the same all the way back to J701,
>> which makes me think that there is something that I am missing in the way
>> that rank is applied.
>>>> a
>> 0 1 2
>> 3 4 5
>> 1 2 x:"0 _ a NB. this is expected
>> 0 1 2
>> 3 4 5
>> 0 0 0
>>>> 0 0 0
>> 0 0 0
>> 0 0 0
>>>>>> 0 1 0
>> 1 1 0
>> 2 1 0
>>>> 3 1 0
>> 4 1 0
>> 5 1 0
>> 1 2 x:"0 a NB. this is was unexpected. Shouldn't it be the same as
>> the result of 1 2 x:"0 _ a
>> 0 0
>> 1 0
>> 2 0
>>>> 3 1
>> 4 1
>> 5 1
>> 2 x:"0 a NB. the constituent parts behave as expected with rank 0
>> 0 1
>> 1 1
>> 2 1
>>>> 3 1
>> 4 1
>> 5 1
>> 1 x:"0 a
>> 0 1 2
>> 3 4 5
>>>> Cheers, bob
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>> -- 
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /