In simple words: It takes first value before space from a string and cast it to symbol.
Ex: Input "Hello World" will give output `Hello
q> {`$first x vs y} [" ";"Hello World"]
Output: `Hello
You can test it with simple list (column in your query will be replaced by actual list from table corresponding to that column )
q> " "{`$first x vs y}/: ("hello world" ; "test program")
output: hellotest
Comparing this to ex1, " " is moved to start which is due to syntax of "each right(/:)"
Alternate simpler version of this is:
q){`$first " " vs x } each ("hello world" ; "test program")
WooiKent has already explained the functions. But here are some references:
Each-Right(/:) : It is a loop which iterates over values of right list
http://code.kx.com/q/ref/adverbs/#each-right
vs(Vector From Scalar): Break a string on some delimiter
http://code.kx.com/q/ref/casting/#vs
In your query, it takes a column whose type is string as input. For each element(row) of that column, takes first value before space. Finally cast that value to symbol.