Q by Puzzles

4 February 2021 | 2 minutes

by Stephen Taylor, KX Librarian.

In the beginning, there was no reference. When developers with vector-programming experience wrote terse, fast q solutions without loops or control structures, awed scalar developers called them “the q gods”.

The leading kdb+ textbook is even called Q for Mortals. The metaphor honors the skill, but places it beyond our reach.

The power of q is not reserved to members of a divine race. It is available to anyone who wants it. It yields to study, immersion, and practice.

Think like a mountain

Vector languages such as q support a particular way of thinking about problems and solutions.

Experience with other programming languages taught me to analyze problems into loops, tests, and cases. This is the scalar approach. You can write q this way, but it will limit what you can get done.

Iteration is largely free in q: it is implicit in most of the primitives.
That is so we can stop thinking about iterations and think instead about operations on lists and other structures.

Fire from heaven

The shift to vector thinking can be a challenge. Play is an excellent way to explore new techniques.

Q by Puzzles is the start of a new section on code.kx.com. It studies vector programming techniques in the context of simple problems. They explore distinctive features of q in some depth.

Use them to train your brain for q.

Demo kdb, the fastest time-series data analytics engine in the cloud








    For information on how we collect and use your data, please see our privacy notice. By clicking “Download Now” you understand and accept the terms of the License Agreement and the Acceptable Use Policy.