Live data from Hacker News

The Q Language

code.kx.com

131–140 of 161 posts

Re: The Q Language

#131

I mostly love K/Q, and recently rearranged my career to do more of it. There are some things to be aware of, though: * If your code doesn't spend most of its time in primitive verbs operating on large vectors, it's gonna be more or less as slow as any other interpreted language. Q and kdb+ can be fast and beautiful if you can arrange your problem in the right way, but it's not magic. * The internals are locked away.…

Curious to know what you did to rearrange your career.

Re: The Q Language

#132
post #48

Earlier quoted context omitted.

It takes time getting used to, yes. And it is not for all people. But it's just a foreign language; You could look at Japanese text[0] and make similar statements, and would be just as valid (or rather, invalid) as your statement. You expect to be able to read it because you're used to a class of languages which are all similar enough at the surface level -- perhaps you are even familiar with more than one fundamenta…

The difference between "#define Z static" and Japanese is that Japanese is an effective method of communicating between 125 million people.

And k/q is an effective method of writing very fast software for domains such as finance understood by thousands of people.

Just because you find it strange, it does not mean it's strange.

I'm sure you'd find languages in Papua New Guinea difficult at times, and you'd argue English is "better" because more people speak it, and there is a richer literature in it, but the ideas expressed in those languages - and how they are expressed uniquely in those languages - are valuable to the people who speak them.

Re: The Q Language

#133

Earlier quoted context omitted.

Enjoyed the blog post from Sustrik. I also found Hintjens' work in line with my own sensibilities, e.g., his libero code generator. That is perhaps a good example of "finished" software. Whenever I have suggested on HN that there is such a thing as "finished" software that is free of serious bugs, I get some resistance. There is a consistent knee-jerk reaction citing the same tired, old meme, "All software has bugs",…

> There is a consistent knee-jerk reaction citing the same tired, old meme, "All software has bugs", and "Software is never finished." It's not as much of a meme as fairly good heuristics. Most software has bugs, or depend on other pieces of software who have bugs. Most software can be improved or integrate with new technologies that weren't prevalent a few years ago. If software is good, it generally has a solid use…

I tend to think it's more about people using languages that fail to correctly provide enough assurances about how they function in all cases that assumptions have to be made in practical use, and those assumptions end up being wrong in odd, minute ways, or on new platforms with slightly different behaviors, or after compiler writers decide they want to take advantage of some ambiguity for the sake of performance.

When someone trying your software with a newer compiler or a newer CPU or a slightly different architecture than you wrote it on and it doesn't work right, it's easy to come away thinking programs are never "done".

Re: The Q Language

#134

I worked in Pascal, C/C++, Java, Python, R, Nim, Clojure, Rust, Go, Js, and created various projects in these languages. However, I couldn't get used to Q. I understand that it is fast, and I also started to like the functional programming aspect of it. But oh boy, there is no proper error messages (no, "`type" is not helpful). The short versions of various map and apply were handy, but there are no equivalent versio…

> The strange evaluation order made it impossible for me to read other people's code,

Its quite strictly evaluated right to left... Which I think is one of the best features over most other languages.

Re: The Q Language

#135
Q is great. I think wider adoption would come from two places:

1. adding more syntactic sugar to the language to improve readability

2. open-sourcing the thing or building an open-source compatible Q interpreter with all the nice features of KDB (functional programming, vector-based data structures, "scripting language within a database" approach, web features: HTTP server and websockets, etc.. etc.. )

Re: The Q Language

#136
post #30
post #17

what makes kdb so special and why isn't there an open/libre alternative?

But there are: k variants: kona (C, interpreter): https://github.com/kevinlawler/kona klong (C, interpreter): http://t3x.org/klong/ kuc (C++, JITted): http://althenia.net/kuc oK (JS, interpreter): https://github.com/JohnEarnest/ok (see also iKe by John Earnest) cousins: J (C, interpreter) http://jsoftware.com/ A+ (C, interpreter, unmaintained): http://www.aplusdev.org/index.html Gnu APL (C, interpreter): https://www.…

Nice list of alternatives. But the original question was what makes it so special? What does it have that these open-source variants don't?

Re: The Q Language

#137
post #136
post #30

Earlier quoted context omitted.

But there are: k variants: kona (C, interpreter): https://github.com/kevinlawler/kona klong (C, interpreter): http://t3x.org/klong/ kuc (C++, JITted): http://althenia.net/kuc oK (JS, interpreter): https://github.com/JohnEarnest/ok (see also iKe by John Earnest) cousins: J (C, interpreter) http://jsoftware.com/ A+ (C, interpreter, unmaintained): http://www.aplusdev.org/index.html Gnu APL (C, interpreter): https://www.…

Nice list of alternatives. But the original question was what makes it so special? What does it have that these open-source variants don't?

For a certain set of applications, I believe the difference is speed. K has been said to even outpace C, even though that's the language it's written in. AW did an amazing job with his optimizations.

Re: The Q Language

#138
post #117

I worked in Pascal, C/C++, Java, Python, R, Nim, Clojure, Rust, Go, Js, and created various projects in these languages. However, I couldn't get used to Q. I understand that it is fast, and I also started to like the functional programming aspect of it. But oh boy, there is no proper error messages (no, "`type" is not helpful). The short versions of various map and apply were handy, but there are no equivalent versio…

I have worked in C (twenty-five years), C++, Python, Perl (twenty years), JavaScript, Common Lisp (for ten years), OCaml, forth, postscript, and also q/Kdb. I think a lot can be done to improve teaching q/Kdb. The current “best practice” is to change you until it makes sense but this takes time- anywhere from 6 months to a couple years based on your other experiences. And you still have to want to “get it”. I want th…

Hi Geo,

Thank you for the time to respond. I understand that speed is very important and I'm happy that Q takes it seriously. I was never questioning that part. I also understand the beauty of functional programming paradigms (working with maps and applys), I wrote many lines in Mathematica without "for" loops. I also understood many code snippets written by developers working only with Q (I guess they are experts). I don't know the full power of Q, but I can imagine what is achievable.

I haven't worked with Q for 18 months, the debugger sounds cool. Forgive me if my knowledge is not up-to-date. Also I wanted to use the language immediately without learning it for months, which might be the main source of my frustration.

I believe that there could be a better developer environment without making the system slower, and that could reduce the time required to use the language efficiently from the several months to several days or hours.

The evaluation order is not clear to me. I understand this expression:

  q){x+2*y} scan 2 3 5 7 
(the result is: 2 8 18 32). However, I often had to read more complicated code which contained 1 or 2 character long operators. Without fully understand their syntax, I was unable to tell whether those operators take values from both sides, which stopped me from understanding the evaluation order. It would be great if a tool could convert this expression to

  q)scan[{x+2*y};2 3 5 7]
and that tool also would replace cryptic 2 character long operators by long readable names (e.g., MapForTables).

I think that the error messages need to be as verbose as possible. You mentioned that experts don't ask for the debugger and verbose error messages. I think that they simply got used to not having these useful features, but they would use them eventually. I'm okey with the limited number of variables until it gives a proper error message if violated.

People working with Q told me that it was hard for them to restart working with Q after 1 month break, because they forgot the lexical knowledge needed for the efficient work.

Peter

Re: The Q Language

#139

Earlier quoted context omitted.

Yea, I was just saying the key mappings can be a pain and your favorite keyboard probably doesn't have the APL symbols on it. The Dyalog IDE has a virtual keyboard, but I don't like those too much. If none of that bothers you, than no biggie. I'm guessing Dyalog has more production users and a bit more users than you see at the conference as they are typically held in the UK. J is free, so I bet a lot more people try…

My background is I know too many languages and don't get enough shit done and my need is probably to stop it and get back to work. :) Being slightly more serious, I do web dev, mostly backend, for a radio astronomy observatory. I don't know anything about the science, but I wind up executing their routines in the cluster and doing typical database apps. I don't have much time on the side but I have been enjoying tryi…

I also dabble in Dyalog APL. I have an inexplicable bias for the symbols, however I really like J and the commmunity. I have played with Jd with a trial license, and as said above, J is free and the source is available for scrutiny. I have played with using the J DLLs in my C code. I am always amazed at my takeaway understanding of a mathematics problem after working it out in J. It somehow gels it in my mind, and fits with the equations in normal math symbols.

I am one of those who stare at arrays! [1]

  [1]  http://www.aprogramminglanguage.com/

Re: The Q Language

#140
post #45

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

Welp, you were not kidding: https://github.com/KxSystems/kdb/blob/master/c/c/curl.c This code is basically obfuscated by hand. Absolutely unapproachable. Only the original author(s) can understand it. Judging by other comments, it seems to work well. So they seem to be good programmers producing working code. It's just not intelligible by other human beings, which is a pretty bad thing, but not the only factor in sof…

[deleted]
Post reply on HN