To list the tables in the current namespace, use \a; to list the tables from a specific namespace, both \a namespace and tables `namespace work:

$ q sp.q
KDB+ 2.7 2011.02.16 Copyright © 1993-2011 Kx Systems
+`p`city!(`p$`p1`p2`p3`p4`p5`p6`p1`p2;`london`london`london`l..
(+(,`color)!,`blue`green`red)!+(,`qty)!,900 1000 1200
+`s`p`qty!(`s$`s1`s1`s1`s2`s3`s4;`p$`p1`p4`p6`p2`p2`p4;300 200 100 400 200 300)
q)\a
`p`s`sp
q)\a .
`p`s`sp
q)tables `.
`p`s`sp
q)

Like any other value, you can do the following with functions:

  • pass them as arguments to other functions
  • return them from functions
  • create new functions at run time

In fact, since the syntax of q is consistent with the semantic similarity between calling a function and indexing a data structure, sometimes you won’t even care whether a particular value is a function or data.

Tables can be treated as ordinary data as well. In a typical database, tables can only be manipulated and queried using a special language via a specific access mechanism (.NET’s LINQ is Microsoft’s effort to bridge the gap). In q, although you can use a query language when convenient, you can also use any other feature of the q language that you might want. For example, sometime it’s much simpler or faster to express a table update using . (apply).

No. Please see wikipedia entry on Purely functional and programming language family tree diagram (K is found toward the left, as a decendent of APL & Scheme.