This text represents a complete rewrite of Q for Mortals. Although the Table of Contents may look familiar, very little of the original text survived. This version targets all the features of q3.2, as well as correcting both errors of omission and commission in the original. All code snippets have been copied from the q3.2 console but they should work unchanged in q3.3. Please send corrections, additions and constructive suggestions to

HTML edition

This HTML edition is published by Kx by permission of the author. Please notify any errors in this edition to

A significant improvement in this version is that the author was learning q while writing the original, but he actually knows some q now. One thing that hasn’t changed is the author’s philosophy: You can only be young once but you can be immature your entire life.

Numerous people have been instrumental in shepherding this to print. First and foremost, the folks at First Derivatives and Kx. Of course, there would be no q gods or mortals without Arthur Whitney’s brilliant invention of q and kdb+. Janet Lustgarten has been supportive of the effort from day one. Abby Gruen served as the midwife during the book’s birth. Charles Skelton kept me honest. Simon Garland patiently answered my innumerable naïve q questions. Brian Conlon and Victoria Shanks invited me to announce the book at Kx meetups.

Many colleagues suffered through early drafts of the text. My go-to proofreaders were Jose Cambronero, Kevin Ching, Simon Garland, Fermin Reig and Mike Rosenberg. They persevered through my horrendous typing and Word’s inability to spell-check the document – invariably insisting it was in French – over countless drafts. They also made valuable suggestions regarding content and presentation. To the others who are unnamed I am nonetheless grateful. All remaining errors are mine alone.

Thanks to Omar for patience and support as I spent weekends and vacations tethered to my MacBook. And thanks to Nuba and Devi for providing necessary distractions.


Since Q for Mortals went to press we have revised the terminology used in in order to follow common usage more closely. Monadic and dyadic functions are now respectively unary and binary, and verbs are now operators: functions that can be used infix.

None of this should present any difficulty to the reader of this book.