Search code examples
kdb

how to use each to pass sets of variables to a function in q


I have a function that deletes and works using a directory and a table and column as variables:

Delete1[dir,t,c]

Another that retruns a set of directories that works:

Paths[dir]

Now I am trying to combine these two using something like "each" to all the directories that Paths[dir] to Delete1 function and I am trying something like this:

Delete1 each (Paths[dir];t;c)

The syntax does not quite work.


Solution

  • You want to use projection. Supplying only the second and third arguments to the Delete1 function creates a new function with just one argument. You can use each between the projection and Paths

    Delete1[;t;c] each Paths[dir]