To put this another way, (x = y) compares atoms and will produce an array if applied to an array (and will give length error if applied to arrays that don't agree).  (x -: y) answers the question 'are these things the same?' and returns 0 or 1.

In if.-statements, you usually want -:

if. x = y do.
...
end.

Only the first atom of the result of (x = y) is tested.


It is not true that ,0 and 0 are treated the same.  That is an illusion fostered by the fact that leading axes of 1 have no effect on display.  Play with

z =: 0
az =: ,0

and see the differences between

z + az   and  z + az
z +/ az  and  z +/ z   and   az +/ az

You might want to use dissect to display the shapes, which is how these results differ.

Henry Rich



On 12/20/2017 2:04 AM, Raul Miller wrote:
Or, more specifically, = is comparing atoms (the things that go into
arrays, which includes everything in a box - including the shape of
things in the box).

Thanks,



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

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

Reply via email to