Unexplained Results Using Vector (Simple List) Notation

I was talking to my friend Stanley last night about Q and he mentioned that he’d tried some expressions that returned results he couldn’t explain.

I took a look and it seemed that these expressions should have returned a “syntax error” of sorts–whatever that is in Q.  We both have APL backgrounds and APL would give a SYNTAX ERROR.

Am I missing something regarding how these expressions are being interpreted?  Thanks for any insight.

q)2 111b

2


q)count 2 111b

1


q)2 0N 111b

0N 0N 0N

q)2 3 111b

3 3 3


q)2 3 4 111b

3 3 3


q)2 3 4 101b

3 2 3

stdin 0

stdout 1

stderr 2

q)1 “hello” / write char vector to stdout, returns and prints the handle
hello1
q)1 “hello”; / suppress printing the handle
helloq)
q)-1 “hello”; / -1 adds a line return
hello

q)2 0x0161 / writes bytes to stderr
a2

q)“ab” 011b / index the “ab” vector using the indicies 0 1 1
“abb”

Thanks Charles, we’re both boning up on the notation at the moment and didn’t think about the file handles.  I’ll pass along the information to Stanley.  The juxtaposition throws some wrinkles in things that in APL would have been considered vector notation, but that’s OK.