I'd say forget the binary representation.

The primitives, namely ;: u;.n u\ u\. u/. produce lists even when there is only one item in the partition. Very regular.

The anomalous case stems from simple old keyboard entry. You ran into trouble from

'a';'bcd'

because 'a' creates an atom, while 'bcd' creates a list. You have to become sensitized to this. There's just something special about a single character or a single number: they are atoms.

You would have the same problem with

1 ; 2 3 4

1 is an atom; 2 3 4 is a list.


It's like learning to run IEHIOSUP after changing an SVC: after you get burned enough you stop making that mistake.

Henry Rich

On 1/19/2014 10:59 PM, Joe Bogner wrote:
Roger & Henry - Thank you for the explanations

I had a feeling that the arrays were structurally different but I
couldn't figure out how to tell.

I also narrowed it down to my use of cut. I will study that to
understand further

These were the ways I tried to look before

]a=:('a';'bcd')

┌─┬───┐
│a│bcd│
└─┴───┘

]b=:(' ' cut 'a bcd')

┌─┬───┐
│a│bcd│
└─┴───┘

$ a
2

$ b
2

Other clues that they were different

    $ each a

┌┬─┐
││3│
└┴─┘

$ each b

┌─┬─┐
│1│3│
└─┴─┘

I guess this would be the ultimate test -- the binary representation


* (manually removed the last one from the first column that was filled)

    (<(19 $ (3!:3 a))),.<(3!:3 b)
┌────────┬────────┐
│e1000000│e1000000│
│20000000│20000000│
│02000000│02000000│
│01000000│01000000│
│02000000│02000000│
│1c000000│1c000000│
│30000000│34000000│
│e1000000│e1000000│
│02000000│02000000│
│01000000│01000000│
│00000000│01000000│
│61000000│01000000│
│e1000000│61000000│
│02000000│e1000000│
│03000000│02000000│
│01000000│03000000│
│03000000│01000000│
│62636400│03000000│
│              │62636400│
└────────┴────────┘

Is there an easier way to visualize or identify the difference?

words also creates a 1 rank boxed string and can't be compared with <'a'

  (<'a') i. (;: 'a b c a')
1 1 1 1

Henry's suggestion works:

(<,'a') i. (;: 'a b c a')
0 1 1 0
----------------------------------------------------------------------
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