how does vector \[1] work?

can some one please explain how scan works, when the left arg is a vector and the right arg is either atom or vector?

tia.

q)0 3 6 2 5 1 4[1]           / / from idiom # 1005 of qidioms

1 3 2 6 4 5

)q 5 2 0 [1]

1 2 0 5 0N

q)4 6 1[1 2 3]

1 2 3

6 1  

  6  

Just imagine the verb being indexing (@)

Cheers,
? Attila

so "" is used as iteration in this case, and as Attila said, the verb is indexing

iteration returns result as:
x,f(x),f(f(x)),f(f(f(x))),…

http://code.kx.com/wiki/Reference/BackSlash

so to explain the first question:

q)0 3 6 2 5 1 4[1]

1 3 2 6 4 5

the first result is 1, so return 1

use the first result and index ( (0 3 6 2 5 1 4)[1] ) which return 3

use the second result and index ( (0 3 6 2 5 1 4)[3] ) which return 2

use the third result and index ( (0 3 6 2 5 1 4)[2] ) which return 6

use the fourth result and index ( (0 3 6 2 5 1 4)[6] ) which return 4

use the fifth result and index ( (0 3 6 2 5 1 4)[4] ) which return 5

the result stops here because if you use the sixth result and index ( (0 3 6 2 5 1 4)[5] ) which return 1, the result (1 3 2 6 4 5) will just keep repeating itself indefinitely

so the best result q can return is 1 3 2 6 4 5 in the end…

if you use this logic on second and third question, it will be clearer

Thank you all, really appreciate it. Next time, I will read the documentation first.