Skip to content

The Q Playbook

Play chess

The q language favors terse code that exploits the iteration implicit in the primitives.

Accustomed to analyze problems into loops, tests, and cases? The shift to array thinking can be a challenge. Play is an excellent way to explore new techniques.

The playbook studies array-oriented programming techniques in the context of simple problems. They explore distinctive language features in some depth.

Use them to train your brain for q.

problem solution features code lines
12 Days of Christmas Map a simple data structure to a complex one
Index At with nested indexes
Amend and Amend At to make changes at depth
2
ABC Problem Search a tree of possibilities, stop when found
recursion
Each right
Index At with nested indexes
3
Abundant Odds Find values in a series that pass a test
Each, Do, and While iterators
composition
7
Four is Magic Convergence and finite-state machines
Converge iterator
composition
Index, Index At
7
The Name Game Make substitutions in a string or list of strings
projection
ssr
Amend At
Do and Over iterators
5
Summarize and Say Analyze a dictionary of results; map between dictionaries
composition
hash dictionary
Do iterator
reverse lookup
iterator syntax
7