You've not spotted the right difference.

It's not that 'r' has length 1 while 're' has length 2.  It's that 'r' has rank 0 while 're' has rank 1.  When you change the rank of the argument you change the rank of the result.

To make your program behave the same on atoms as on 1-atom lists, apply , to the argument:

   $ (,'rebe') e./ "1 0 i. 2 5
2 5 4
   $ (,'r') e./ "1 0 i. 2 5
2 5 1

Henry Rich


On 2/24/2022 1:03 PM, Richard Donovan wrote:
Well Henry I didn’t mean that because I didn’t know about it!

It is a test to check if all y is contained in x which worked fine until y had 
a length of one! I spent all afternoon debugging it until I somehow managed to 
check the shape of things and to my surprise the length-one case is treated 
differently!

Does this apply to every operation on data that may be one or more characters?

Thanks

Richard Donovan









On 24 Feb 2022, at 17:34, Henry Rich <henryhr...@gmail.com> wrote:

Did you mean

    $ (,'r') e./ "1 0 test
2 5 1

?  Note that

    $ 'r' e. 'a'

    $ (,'r') e. 'a'
1


Henry Rich

On 2/24/2022 12:29 PM, Richard Donovan wrote:
J901 Windows




$test

2 5



$ 're' e./ "1 0 test

2 5 2



$ 'rebe' e./ "1 0 test

2 5 4



Etc. BUT





$ 'r' e./ "1 0 test
2 5

This has caused me no end of problems and appears to be totally inconsistent.

Bug or feature?

Richard Donovan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to