Live data from Hacker News

The Q Language

code.kx.com

31–40 of 161 posts

Re: The Q Language

#31

... and can you use the 32bit version in commercial use? (Last I checked, no...) The license already changed once (for the worse, IMnsHO), so what's to say that won't happen again. Too risky to touch. No, can't use it (32bit version) for commercial, so this is a non-starter. Sorry. kOS? really? https://news.ycombinator.com/item?id=8475809

You can purchase a license if you want to be unaffected by future license changes. It might not be the right price for you, but it is for some. They are, in fact, courting only rich customers.

Some languages are worth learning to expand your horizons. Lisp is one of them, even if you never use it, and the APL family (of which K/Q are members) is another. My C code has become faster, simpler, shorter and less buggy after I dabbled in K. YMMV, but using it in a commercial setting is not the only reason to look at it.

> kOS? really? https://news.ycombinator.com/item?id=8475809

Really. What exactly is your "really?" question?

Re: The Q Language

#33
post #27

This is only software I have ever seen that actually got smaller over time. Not only that, it is the only software I have ever seen that used a GUI and then ditched it in a subsequent version. Few programs are so aligned with my own software sensibilities. Only complaint is that they used to have a FreeBSD port and now only have Linux and macOS but no BSD. Unfortunately Linux compat in BSD is being perceived by some…

> This is only software I have ever seen that actually got smaller over time. I agree, this is admirable! Even if it is under different names (which I think is a far better approach), Sustrik does this too: http://250bpm.com/blog:50 He went from AMPQ (not his own creation) -> ZeroMQ -> nanomsg -> Libmill (essentially Go in C/UNIX style) Also, OpenBSD comes to mind (LibreSSL for example).

Libmill/Libdill (go coroutines) are not on the AMPQ->ZeroMQ->Crossroads->Nanomsg (socket abstraction) path ; in fact, they have essentially nothing in common except sustrik.

Re: The Q Language

#34
The KDB code is terse to an unhealthy extreme. Check this gem:

    // remove more clutter
    #define O printf
    #define R return
    #define Z static
    #define P(x,y) {if(x)R(y);}
    #define U(x) P(!(x),0)
    #define SW switch
    #define CS(n,x)	case n:x;break;
https://github.com/KxSystems/kdb/blob/master/c/c/k.h#L96

Or this wall of code:

https://github.com/KxSystems/kdb/blob/master/c/c.cs

Re: The Q Language

#35
post #22

Notes from my KX/kdb experience: 1.) The in-memory DB .exe was around 500 KB. Imagine that. 2.) The Q language syntax, while consistent, is fairly arcane and throwback to decades past. 3.) The documentation and driver support is abysmal. 4.) It's supposedly extremely fast, but I can't help but wonder if this is a lot of successful PR and hype (like hedge fund bosses insisting on Oracle because it's the only db that '…

I used to use KX/kdb/Q/K daily for several years. I wrote a full implementation of reinforcement learning (15 lines), a lightweight MVC framework (to show reports and tables in an internal webapp) and even a Q syntax checker (abusing table as a data structure to hold parse trees). Good or bad, for the longest time, Q was my "go-to" programming language. Based on that experience... 1) Yes, but that's not huge by moder…

It is worth pointing out that really fast is ... well ... really fast. See [1] for some benchmarks they did for small, medium, large data sets.

The machines that $dayjob-1 used to build dominated the STAC-M3 for a few years (2013-2015) because we paid careful attention to how kdb liked to work, and how users liked to structure their shards. Our IO engine was built to handle that exceptionally well, so, not only did in-memory operations roar, the out of memory streaming from disk ops positively screamed on our units (and whimpered on others).

I miss those days to some degree. Was kind of fun to have a set of insanely fast boxen to work with.

[1] http://kparc.com/q4/readme.txt

Re: The Q Language

#36
post #33
post #27

Earlier quoted context omitted.

> This is only software I have ever seen that actually got smaller over time. I agree, this is admirable! Even if it is under different names (which I think is a far better approach), Sustrik does this too: http://250bpm.com/blog:50 He went from AMPQ (not his own creation) -> ZeroMQ -> nanomsg -> Libmill (essentially Go in C/UNIX style) Also, OpenBSD comes to mind (LibreSSL for example).

Libmill/Libdill (go coroutines) are not on the AMPQ->ZeroMQ->Crossroads->Nanomsg (socket abstraction) path ; in fact, they have essentially nothing in common except sustrik.

I wish you'd actually read the article before shooting your mouth off with a Well Actually. FTA:

> Next one: nanomsg. An alternative to ZeroMQ.

In comments:

> How would you split nanomsg, then?

> [...] 2. coroutine library, e.g. libtask, libmill [...]

Not to mention that this is obvious if you understand what the core of each thing is in terms of capabilities. If you are gonna be the "technically..." guy, at least do it right.

It's about decomposing things, which is the essence of good design, and - supposedly - the UNIX philosophy at its heart.

Re: The Q Language

#37

As an outsider, my initial reaction is "does every new database system have to come up with their own SQL-like language?"

SQL's only virtue is that it is well known; It is otherwise not very good compared to other query languages, and every SQL engine extends it somewhat differently, extensions which you can't avoid cause the standard is too limited. I agree most query languages would be better off as minor extensions to SQL - but kdb+/Q is different.

Unlike SQL which pays lip service to Codd's relational model but breaks it with things like TOP, ORDER BY, LIMIT and others, the Q language embraces the order between tuples to great effect, making e.g. "as-of" queries which are quite common trivial; whereas in SQL and the relational model, as-of queries are inefficient in either execution time or storage space (usually both), and reasonable execution speed schemas cannot, in fact, guarantee their integrity (which is often quoted as one of the the main advantages of the relational model).

As another example, Q implements "foreign key chasing" also called "reference chasing", which is also implemented in the web2py DAL and surely others; compare[0] the equivalent tpc-h query:

in q:

   select revenue avg supplier.nation=`BRAZIL by order.date.year from lineitem
    where order.customer.nation.region=`AMERICA, order.date.year in 1995 1996, part.type=`STEEL
in sql:

   select o_year,sum(case when nation = 'BRAZIL' then revenue else 0 end)/sum(revenue) as mkt_share
   from(select year(o_orderdate) as o_year,revenue,n2.n_name as nation
    from part,supplier,lineitem,orders,customer,nation n1,nation n2,region
    where p_partkey = l_partkey and s_suppkey = l_suppkey and l_orderkey = o_orderkey
     and o_custkey = c_custkey and c_nationkey = n1.n_nationkey
     and n1.n_regionkey = r_regionkey and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey
     and o_orderdate between date('1995-01-01') and date('1996-12-31') and p_type = 'STEEL') 
    as all_nations group by o_year order by o_year;
[0] bottom of http://kparc.com/d.txt

Re: The Q Language

#38
post #2

Aside: has anyone heard any recent news about the K5/K6 rewrites of the underlying interpreter? There was a fair amount of chatter about these a couple of years ago, but all gone rather quiet... (Some context: http://archive.vector.org.uk/art10501320 )

Currently it looks like k7 is going to be an actual commercial product in the near-ish future. Arthur is still hashing the details out, but the language design is substantially similar to k6. If anyone ideas or strong opinions about how to make k7 better, now would be a pretty good time to email Arthur.

For those not already in the loop with respect to k6, the reference card (http://kparc.com/k.txt) provides a good overview. Note that it is neither exhaustive nor completely representative of the current state of the language.

Re: The Q Language

#39

The KDB code is terse to an unhealthy extreme. Check this gem: // remove more clutter #define O printf #define R return #define Z static #define P(x,y) {if(x)R(y);} #define U(x) P(!(x),0) #define SW switch #define CS(n,x) case n:x;break; https://github.com/KxSystems/kdb/blob/master/c/c/k.h#L96 Or this wall of code: https://github.com/KxSystems/kdb/blob/master/c/c.cs

[deleted]

Re: The Q Language

#40

Q was the subject of an awesome presentation by Tim Thornton at YOW! Lambda Jam 2016. [1] https://www.youtube.com/watch?v=ZGIPmC6wi7E

His description of primality testing in that video is really quite good[1]. If it starts too slow, maybe that's a good place to start?

[1]: https://youtu.be/ZGIPmC6wi7E?t=9m56s

Post reply on HN