Contents
Q for Mortals
by Jeffry A. Borror
Version 4.1 November 2025
Published in HTML by Kx Systems, by permission. Please notify any errors in this edition to docs@kx.com.
- Preface
- 0. Overview
- 1. Q Shock and Awe
- 1.1 Starting q
- 1.2 Variables
- 1.3 Whitespace
- 1.4 The Q Console
- 1.5 Comments
- 1.6 Assignment
- 1.7 Order of Evaluation
- 1.8 Data Types 101
- 1.9 Lists 101
- 1.10 Functions 101
- 1.11 Functions on Lists 101
- 1.12 Example: Fibonacci Numbers
- 1.13 Example: Newton's Method for nth Roots
- 1.14 Example: FIFO Allocation
- 1.15 Dictionaries and Tables 101
- 1.16 qSQL 101
- 1.17 Example: Trades Table
- 1.18 File I/O 101
- 1.19 Interprocess Communication 101
- 1.20 Example: Asynchronous Callbacks
- 2. Basic Data Types: Atoms
- 3. Lists
- 3.0 Overview
- 3.1 Introduction to Lists
- 3.2 Simple Lists
- 3.3 Empty and Singleton Lists
- 3.4 Indexing
- 3.5 Combining Lists
- 3.6 Lists as Maps
- 3.7 Nesting
- 3.8 Iterated Indexing and Indexing at Depth
- 3.9 Indexing via Lists
- 3.10 Elided Indices
- 3.11 Rectangular Lists and Matrices
- 3.12 Pattern Matching on Lists (Advanced)
- 3.13 Basic List Operators
- 4. Operators
- 4.0 Operators Are Functions
- 4.1 Operator Precedence
- 4.2 Match (~)
- 4.3 Equality and Relational Operators
- 4.4 Basic Arithmetic: +, -, *, %
- 4.5 Greater | and Lesser &
- 4.6 Amend (:)
- 4.7 Exponential Primitives: sqrt, exp, log, xexp, xlog
- 4.8 More Numeric Primitives
- 4.9 Operations on Temporal Values
- 4.10 Operations on Infinities and Nulls
- 4.11 Views (::) (Advanced)
- 5. Dictionaries
- 6. Functions
- 7. Transforming Data
- 8. Tables
- 9. Queries: q-sql
- 10. Execution Control
- 11. I/O
- 12. Workspace Organization
- 13. Commands and System Variables
- 14. Introduction to kdb+
- Appendix A. Built-in Functions