I’ve found quite a lot of documentation on q but cannot find anythingexplaining k syntax, is there anything available on the web or inprint?
On Mar 16, 2011, at 1:17 PM, john stembridge wrote:
> I’ve found quite a lot of documentation on q but cannot find anything
> explaining k syntax, is there anything available on the web or in
> print?
for k4, not really. there’s some old stuff floating around for k3 & k2
the main difference is that most of the monadic functions (and “function
adverbs”–each, over, scan, prior, sv, vs) in q are punctuation in k–if
you load http://kx.com/q/d/help.q you can see the mapping with
“helpverbs" and "help
adverbs”, or just type the function on its own at
the q prompt
q)flip
+:
q)each
k){x’y}
(the colon forces it to be the monadic + (flip), not the dyadic (add);
it’s sometimes optional depending on parsing rules i don’t fully
understand)
other syntactic stuff
the .q namespace isn’t blessed, so anything from there needs to be
referenced with its full name (e.g. “.q.flip”) and can’t be infix (e.g.
.q.lj[t1;t2])
parsing is a bit different in some other ways (associativity, maybe?);
just add parens until things work :)
@'s are required in some places where whitespace/concatenation would
work in q
lines in a block (function, if/$, etc.) don’t have to be semi-colon
terminated
underscore isn’t allowed in a sym literal (have to say `$“foo_bar”)