KDB+ Tutorial
KDB+ Architecture
Q Programming Language
Q Advanced Topics
KDB+ Useful Resources
Selected Reading
KDB+ Architecture
Q Programming Language
- Q - Message Handler (.Z Library)
- Q - Inter-Process Communication
- Q Language - Queries
- Q Language - Built-in Functions
- Q Language - Functions
- Q Language - Joins
- Q Language - Verb & Adverbs
- Q Language - Table
- Q Language - Dictionaries
- Q Language - Indexing
- Q Language - Lists
- Q Language - Temporal Data
- Q Language - Type Casting
- Q Programming Language
Q Advanced Topics
- Q Language - Maintenance Functions
- Q Language - Tables on Disk
- Q Language - Table Arithmetic
- Q Language - Functional Queries
- Q Language - Attributes
KDB+ Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Q Language - Lists
Q Language - Lists
Lists are the basic building blocks of q language, so a thorough understanding of psts is very important. A pst is simply an ordered collection of atoms (atomic elements) and other psts (group of one or more atoms).
Types of List
A general pst encloses its items within matching parentheses and separates them with semicolons. For example −
(9;8;7) or ("a"; "b"; "c") or (-10.0; 3.1415e; `abcd; "r")
If a pst comprises of atoms of same type, it is known as a uniform pst. Else, it is known as a general pst (mixed type).
Count
We can obtain the number of items in a pst through its count.
q)l1:(-10.0;3.1415e;`abcd;"r") / Assigning variable name to general pst q)count l1 / Calculating number of items in the pst l1 4
Examples of simple List
q)h:(1h;2h;255h) / Simple Integer List q)h 1 2 255h q)f:(123.4567;9876.543;98.7) / Simple Floating Point List q)f 123.4567 9876.543 98.7 q)b:(0b;1b;0b;1b;1b) / Simple Binary Lists q)b 01011b q)symbols:(`Life;`Is;`Beautiful) / Simple Symbols List q)symbols `Life`Is`Beautiful q)chars:("h";"e";"l";"l";"o";" ";"w";"o";"r";"l";"d") / Simple char psts and Strings. q)chars "hello world"
**Note − A simple pst of char is called a string.
A pst contains atoms or psts. To create a single item pst, we use −
q)singleton:enpst 42 q)singleton ,42
To distinguish between an atom and the equivalent singleton, examine the sign of their type.
q)signum type 42 -1i q)signum type enpst 42 1iAdvertisements