Home › Forums › kdb+ › How can i understand the code below › Re: How can i understand the code below
-
Code reads right to left
.Q.en[tabPath] get table // Fetch table (defined by sym/hsym 'table') and enumerate any symbol columns (to sym file located in directory tabPath) (` sv (tabPath; ` ; table; ` ) ) set ... // Save the table (splayed) to a directory defined by '/'-separated path (tabPath/table/) @[;pvar; `p#] pvar xasc ... // Sort by pvar and apply the parted attribute to this column in the table : ... // Return the result (the path to the saved table) ` sv (scalar from vector) joins elements of a filepath. e.g. q)` sv (`:path/to/dir; `filename) `:path/to/dir/filename q)` sv (`:path/to/dir; `filename; `) `:path/to/dir/filename/
It is explained here https://code.kx.com/q/ref/sv/#filepath-components
`p# asserts that the array/column is parted (i.e. common values are adjacent)
It is explained here https://code.kx.com/q/ref/set-attribute/#grouped-and-parted