Top 1,000 Features Creators Resources Blog Explorer Download
GitHub icon

Q

< >

Q is a programming language created in 2003 by Arthur Whitney.

#373on PLDB 21Years Old 768Repos

Q is a proprietary array processing language developed by Arthur Whitney and commercialized by Kx Systems. The language serves as the query language for kdb+, a disk based and in-memory, column-based database. kdb+ is based upon K, a terse variant of APL. Read more on Wikipedia...


Example from hello-world:
"Hello World"
/* Hello world in Q */ hello = writes "Hello, world!\n";
Example from Linguist:
dst:`:tq src:`:tqsrc F:key src / trade fields (types;widths) trf after 200609 tf:`time`ex`sym`s`cond`size`price`stop`corr`seq`cts`trf tt:("TCSS*IFBIJCC ";9 1 6 10 4 9 11 1 2 16 1 1,1+20060930<"I"$-8#string first F) / quote fields (types;widths) qf:`time`ex`sym`s`bid`bsize`ask`asize`cond`mmid`bex`aex`seq`bbo`qbbo`corr`cqs qt:("TCSSFIFIC*CCJCCCC ";9 1 6 10 11 7 11 7 1 4 1 1 16 1 1 1 1 2) / sym[.s] "e"$pricebidask g:{[f;x]`sym`time xcols delete s from @[;`sym;{$[null y;x;` sv x,y]}';x`s]@[x;f;"e"$%;1e4]} foo:{[d;f;t;g;x]@[;`sym;`p#].Q.dsftg[(dst;"D"$-8#string x;d);(` sv src,x;sum t 1;0);f;t;g]} \t foo[`trade;tf;tt;g[`price] ]each F where F like"taqtrade*[0-9]"; \t foo[`quote;qf;qt;g[`bid`ask]]each F where F like"taqquote*[0-9]"; \ http://www.nyxdata.com/Data-Products/Daily-TAQ
Example from Wikipedia:
q)select from t where name like "ja*",age>50 name age -------- jack 60 q)select rows:count i by age from t age| rows ---| ---- 20 | 1 50 | 2 60 | 1

Language features

Feature Supported Token Example
Strings ✓ "
"Hello world"

View source

- Build the next great programming language · About · Acknowledgements · Extensions · Day 628 · Donate · feedback@pldb.io