Want to clear my understanding on how types work: (1; 2; 3)=(1; 2; 3) returns 111b although I know that = only works on atoms but how can 111b be a boolean. Isnt boolean just true or false What does the message `symbol $() mean ? Its not documented anywhere. Its in the MoreAboutTables in the cookbook wiki.
1 2 3=1 2 3 (same as what you wrote) just does a one-to-one comparison of each element across the two vectors, hence the result must be itself a boolean vector.
symbol$() simply denotes an empty list of
symbol type, similar to long$() which denotes an empty list of type long, hence expressing an empty set of a specific type, e.g. x:1 2 3; x where x\>10 leads to
long$(), as nothing matches x>10 condition, but q fortunately still preserves the type.
this is all much better explained in q for mortals btw
http://code.kx.com/wiki2/JB:QforMortals2/contents
= is an atomic function and thus in 1 2 3 = 1 2 3, = is item-wise extended to operate on each corresponding pair of atoms in the left and right operands as in the following expression:
(1=1; 2=2; 3=3)
111b
Since it’s atomic it’s actually extended atom-wise or what would be called “pervasiveness” in APL2:
q)(1; 2 3) = (1; 2 3)
1b
11b
The single true or false answer you are looking for is accomplished with match (~) which is not extended item-wise or atomic.
q)1 2 3 ~ 1 2 3
1b
The Borror book Q for Mortals covers this fairly well, but still leaves a lot to be desired. I am working on a new book that is much more complete in its description of Q. I would start with the Borror book for now as it’ll take you through the basics.
Hope this helps.