Dictionary Bug?

q)d:(0 1;(0 1;2 3);4)!ab`c

q)d
0 1      | a
(0 1;2 3)| b
4        | c

q)a[0 1]
'a

q)a[0 1;2 3]     / bug ?
'a

q)a[(0 1;2 3)]     / bug ?
'a

q)a[4]     / bug
'a

q)a[5]     / bug?
'a

I assume you meant d here, not a , which is why you’re getting 'a (i.e. “what’s a?”)

q) a [0 1;2 3]     / bug ?
'a

For  d [0 1;2 3]

I get 'type… because this actually:

(0 1) d[2 3]  (indexing 0 1 with `)

But you’re right it’s confusing

q)d

0 1      | a

(0 1;2 3)| b

4        | c

q){d x}each key d

`a

a

`

q)d key d

ab`c

q)d key[d]2

`

The weirdness is documented in Q for Mortals.

LOL…sorry about that – I noticed it right after I posted…yes I mean d and not a!  It was late and I was using a lot of one char names … I read the section in the Borror book.  I was working empirically with lists containing items of differing ranks and rather than “weirdness” it seems that the results follow the same rules as the find (?) operator when it is applied to it argument at rank.  I will be writing this up as it’s quite interesting and useful for understanding what appears to be weird behavior.