peachq v0.77 released¶
PeachQ 0.77 is out. This release is about what happens in front of you: a help
system you reach with a single ?, a REPL that starts in modern mode with
autosuggest, and clearer failure when a script goes wrong.
Underneath, qSQL gains real select[n] and select distinct, files can be
appended to without a rewrite, and function values — projections, compositions
and derived functions — now travel over the kdb+ wire in both directions.
Ask the interpreter, not a search engine¶
? is a door onto a help store that ships with PeachQ. ?name prints the
page for a function; ?"some text" searches, treating multiple words as an
AND and ranking a matching name above matching prose.
q)\l pq
q)?trim
│ # `trim`, `ltrim`, `rtrim`
│
│ _Remove leading or trailing nulls from a list_
│
│ ```syntax
│ trim x trim[x]
│ ltrim x ltrim[x]
│ rtrim x rtrim[x]
│ ```
Above the individual functions there is a page tier: an index, a page per namespace, topic pages and a tutorial. All of it is offline by construction — help is content we ship, so it may not depend on a network or cite a tree we do not publish.
The help store itself is written in q. The C side only classifies comment
runs; the @param and @return headers in the standard library are parsed on
load, so a function's documentation and its definition cannot drift apart.
A modern REPL, by default¶
New sessions start in modern mode, with \c console axes chosen from the
terminal and autosuggest as you type. A first session gets a short teach
prompt instead of a wall of banner text.
Startup is also leaner: the standard library is no longer loaded
automatically. \l pq brings in the .pq, .str, .path, .fs and .help
namespaces when you want them.
qSQL: limit and distinct¶
select[n], select[m n], select[n;>c], select[order] and
select distinct are real template forms that lower to the same functional
trees kdb+ produces. The limit applies to the row set before the Select
phrase, so an aggregate over a limited selection aggregates the rows you
asked for.
q)t:([]sym:`a`b`c`a;px:10 20 30 40)
q)select[2] from t
sym px
------
a 10
b 20
q)select distinct sym from t
sym
---
a
b
c
Appending to a file without rewriting it¶
`:file upsert data, .[:file;();,;data]` and file-handle apply all route
through one kernel: in place for plain vectors, appending into compressed
containers, read-then-rewrite for attributed files as documented, and
write-if-absent when the file is not there yet.
q)`:/tmp/prices.bin set 1 2 3
`:/tmp/prices.bin
q)`:/tmp/prices.bin upsert 4 5
`:/tmp/prices.bin
q)get `:/tmp/prices.bin
1 2 3 4 5
Function values cross the wire¶
-8! and -9! now carry projections (104), compositions (105) and the six
derived function types (106–111) in both directions. A projection sent from a
kx q peer decodes into a working function rather than signalling.
q)-9!-8!+[;1]
+[;1]
A standard library with edges¶
\l pq ships Python-shaped string helpers, a lexical path namespace and a
read-safe filesystem namespace — the last deliberately read-only apart from
explicit removal, so exploring a directory cannot damage it.
q)key `.str
``i`strip`lstrip`rstrip`startswith`endswith`removeprefix`removesuffix`isalpha..
q)key `.path
``i`path`string`parent`name`stem`suffix`join
q)key `.fs
``i`exists`isfile`isdir`size`remove`rmdir
Downloads are on the releases page. If you have a q library you would like PeachQ to run next, try it and tell us where it breaks.