Entries in local (2)

Does q have closures?

Not quite. q supports what it calls projections, which are functions whose arguments are partially specified. Projections can serve the same purpose as closures, albeit (and ironically, we might add) with some additional typing:

f: {[list; n]
{[nn; item]
/ n cannot be referenced here,
/ so we pass it as nn
nn + item}[n; ] each list
}

See: Closure

What are some of the hard limits of kdb I should know about?

  • no more than 2GB over IPC
  • number of tables mapped is limited by number of file descriptors allowed by OS
  • maximum of 32 global references per function
  • maximum of 23 local variables per function
  • maximum of 96 constants within a function
  • enums are limited to 57 - (type values 20h to 76h)
  • 4096 maximum compressed files open (for versions earlier than 3.1T2013.02.21)
  • 999 nested columns in splayed table
  • 1022 maximum incoming network connections
  • maximum of eight function parameters
  • maximum number of mapped nested columns 1024
  • maximum number of active `g# indices 1024
  • maximum branch (if; do; while; $[]) distance is 255 byte codes away (from PC to PC+255bytes!) - if you get a 'branch error, you have to break the code up into smaller pieces

See also: error codes