What does it mean for a q function or table to be a ‘first class’ type?
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).