8 ms·
K programming language (2005)
- icen 9y agoIf you want to try out K, you can either go to Kx and download the 32bit version of kdb+. \ at the prompt (on its own) will enter K mode. This uses K4. Alternatively, there's the free and open source Kona, which is an implementation of K3, the preceding version. https://kx.com/download https://kx.com/download https://github.com/kevinlawler/kona https://github.com/kevinlawler/kona
- rkowalick 9y agoI think my favorite way of trying K is John Earnest’s JS-based interpreter Ok: http://johnearnest.github.io/ok/index.html http://johnearnest.github.io/ok/index.html
- throwaway7645 9y agoI wish there was a way to use this at my company without the monstrous price tag. I also wish kdb+ came with much better dashboard support kinda like Tableau...I want to retrieve and mold my data quickly with kdb+'s query language and once it is in the proper form, play with several chart types.
- gaius 9y agoThe 32-bit edition is free
- icen 9y agoCan't be used commercially.
- np_tedious 9y agoYou can build a PoC/argument for why your organization should use it commercially
- throwaway7645 9y agoVery difficult with large IT departments to get something unusual like this since you need hardware, a way to transfer data from your main database into an SSD to really take advantage of kdb+. Doing that would step on the toes of several departments and would require a large project to happen. Then you have the problem where many people aren't array language savvy. If kOS had a better way to build real time dashboards I would pay more attention. I really wish I could get a personal setup at work to do this (on the cheap), but classic IT really hates things outside their cotrol.
- gaius 9y agoclassic IT really hates things outside their cotrol. https://en.wikipedia.org/wiki/Shadow_IT https://en.wikipedia.org/wiki/Shadow_IT The author of that article has a very biased view tho'. An organisation that finds a lot of shadow IT happening probably ought to replace the head of the IT department since he or she is clearly not delivering what the users actually need. From the link: Shadow IT can act as a brake on the adoption of new technology LOL!!!
- throwaway7645 9y agoIT should exist to help the domain users, but after a point they get too big and start to dictate what gets used even if nobody wants it. Like choosing the data analytics technology for the data analytics team when it is what they don't want/need. So then your data analytics team eventually goes outside budget to get what they actually wanted and you have two products. Very dysfunctional and common.
- xamuel 9y agoMy IT department got suuuuuper confused just by the "db" in "kdb". It's a database! That means it must have roles and schemas and basically be a clone of Oracle! Here, fill out these 5,000 pages of paperwork!
- kthielen 9y agoYou might be interested in hobbes, it's free and open source, and we use it with some very large/complex data sets: https://github.com/Morgan-Stanley/hobbes https://github.com/Morgan-Stanley/hobbes The PL is a little different (very similar to Haskell), interoperation with C/C++ is much more direct, and it's also suitable for low-latency applications (where the boxing overhead in K would be unsuitable).
- scottlocklin 9y agoTry Jd; it's almost as good and much cheaper. http://code.jsoftware.com/wiki/Jd/Index http://code.jsoftware.com/wiki/Jd/Index
- dasmoth 9y agoArthur Whitney seems to have been developing this stuff pretty steadily. There's a sparse-but-quite-informative website at http://kparc.com/ http://kparc.com/ where you could follow the development of the K5 and K6 dialects. It's been pretty quiet the last year or so, but there was a comment on HN a month or two back which suggests that K7 could be on its way. For playing around with the basic constructs, https://github.com/JohnEarnest/ok https://github.com/JohnEarnest/ok is nice (and itself pleasingly concise). Currently targeting the K6 dialect, I think. It doesn't really have any of the "database" side of things, though.
- throwaway7645 9y agoAny news on kOS? I'd love to build a barebones high performance computer with K running on bare metal.
- dasmoth 9y agoNothing I’ve seen recently. Seemed to be tied to K5, and there’s been at least one re-write since then.
- scottlocklin 9y agoPretty sure the idea is done; Art's working on other things at the moment.
- beagle3 9y agoThis concise article describes K2 (version 2 of the K language), and, at the level it describes, little has changed, so it is still a good introduction to the language 12 years later. However, beyond the basics, a lot has changed since (current commercial version is K4, current dev is K6 AFAIK): Dictionaries have become better integrated in the language, the database layer was rolled into the language, the integrated (bare bones and milspec-looking but ultra effective) electric GUI was dropped, http and web (as both client and server) were added to the core, 64-bit integers, nanosecond timestamps, GUIDs were added as core types, and probably a few more things I forgot. If you find this article interesting, you may want to experiment with JohnEarnest's ok [0], which provides graphical playground (implemented in JS and runs everywhere) and also read Q for mortals[1] - Q is a syntactic-sugar version of K4, though still the same language underneath. [0] https://github.com/JohnEarnest/ok https://github.com/JohnEarnest/ok [1] http://code.kx.com/q4m3/ http://code.kx.com/q4m3/
- throwaway7645 9y agoWhy remove the GUI stuff?
- RodgerTheGreat 9y agoNo commercial demand. The K2 GUI was very handy for programmers, for rapid prototyping, but it is impractical to use it for making visually polished UIs you would give to a customer. If a feature of K doesn't pull its weight, it is removed.
- throwaway7645 9y agoGotcha...I would assume to leave it in for use in interactive data analysis, but if you REALLY want to keep things small...
- RodgerTheGreat 9y agoArthur starts over completely from scratch with each major release, and abhors drawing in dependencies. It's a good strategy for traveling light.
- empath75 9y agoIs there a variant of this family of language that has readable syntax?
- throwaway7645 9y agoYea it's actually the most readable in the family to those who haven't put the effort into learning the array paradigm. Dyalog APL & J are the two other main languages in the family that have the largest user bases. Both are pretty awesome.
- coliveira 9y ago+1 to J. It is open source, has lots of libraries, documentation, examples, and runs on most mainstream desktop platforms.
- sndean 9y agoQ is a (semi-)readable variant. You can more or less directly translate K symbols to English words. Here's some code for PE question 1: K +/&~&/(!1000)!/:3 5 Q sum where any not {(til x)mod y}[1000] each 3 5
- rscho 9y agoQ'Nial (https://github.com/danlm/QNial7 https://github.com/danlm/QNial7), although it seems pretty much an abandoned language. Searching for it on github yields like, 3 repos. http://www.nial.com/ http://www.nial.com/ is the official website, which also seems abandoned.
- scottlocklin 9y agoQ'Nial was just open sourced a year or so ago; not really an abandoned language.
- dasmoth 9y agoReadability is in the eye of the beholder! (and no, I’m not a K expert — but try working through a few problems and it does gradually start making sense) If you want a slightly more “English like” language which still gives you the array stuff, Q is built on top of K4 and might fit the bill http://code.kx.com/q4m3/ http://code.kx.com/q4m3/
- Athas 9y agoDoes anyone know of a good description of which parts of K's implementation makes it so fast? I have heard the interpreter itself is quite small, and easily fits in L1 CPU cache, which helps of course. Are the primitives further implemented using vector instructions or multi-threading? Does the K interpreter pattern-recognize compositions of constructs and dispatch to an optimized implementation, like with APL "idioms"?
- justincormack 9y agoNo vector instructions at present (I think an older version may have done).
- geocar 9y ago> I have heard the interpreter itself is quite small which helps of course It helps a lot more than a lot: Small is everything. "Main memory" is something like 1000x slower than "L1 CPU cache", so if your whole program lives in L1 you only pay to receive data, which streams in as fast as main memory can. How can you possibly go any faster than that? The interpreter looks a lot like this[1], scan a character, do something with it. There's no scanning phase, or AST, or very much analysis at all. Being simple helps keep it small. Writing dense makes it easy to see (without scrolling) similar code which can be refactored into less space. This is how small (dense) source code can also help make small object code. This is how small (dense) source code is fast! [1]: nsl.com/papers/origins.htm Once you've done all that, vector instructions and multi-threading can help eke out a little bit more speed. Recognising a couple characters at a time and treating them specially can sometimes help as well, but it also can cost a lot of object size quickly, so there needs to be some balance.
- Athas 9y agoYou can "go faster" than memory bandwidth by accessing memory more intelligently (that is, by reducing the amount of memory traffic, possibly by improving cache behaviour). The classic example is loop tiling for matrix multiplication. Here you write significantly more code, but reduce accesses to main memory by a good constant factor. Sadly, with modern architectures, just keeping things small and simple is rarely the way to peak performance. My experience from doing high-performance programming (mostly on GPUs) is that you have a very generous budget when it comes to how large your code can be, but you have an extremely tight budget when it comes to how large your data is. (Of course, in absolute terms you access significantly more data than code, but you generally mostly worry about data size, not so much code size.)
- feelin_googley 9y agoI still use k2 in addition to k4. Being able to see which things change and which stay the same between versions helps in the slow, thorough type of learning process. (I am not a fast learner. I am a thorough learner.) I would love to get a copy of k5 or greater but I am not a programmer by trade and doubt I would pass the audition. Although I stopped using Windows, X11 and Mac a long time ago, I have tried k2 on Windows and it is extremley fast, irrespective of whether the computer is old and "underpowered". I used it to instantaneously generate plots and charts from the command line, instead of driving Excel with some scripting language. This is software from the late 1990s early 2000s. RosettaCode wiki needs to fix its k entries or turn off the silly Cloudflare email protection or whatever is causing the problem. The "@" symbol and subsequent characters are being replaced by "[email protected]". https://rosettcode.org/wiki/Category:K https://rosettcode.org/wiki/Category:K k4 can be integrated into daily use in UNIX-like OS for text processing. Professional example: https://github.com/adavies42/qist/blob/master/lib/awq.k https://github.com/adavies42/qist/blob/master/lib/awq.k Amateur example: (remove all duplicate lines) AWK #!/bin/sh awk '!a[$0]++' < $1 > $1.tmp; exec mv -v $1.tmp $1; k4 #!/bin/sh exec echo "k).Q.fs[l:0::\`:$1];l:?:l;\`:$1 0:l"|exec q >&2; Experiment: keep increasing the size of the file passed as $1 until the AWK version fails.
- feelin_googley 9y agohttps://github.com/JohnEarnest/ok/blob/gh-pages/docs/Fromk5Tok6.md https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Fromk5T...: Padding Can Truncate (Done) In k5, padding was treated as a minimum size for the output string: 2$"abcde" "ab" 6$"abcde" "abcde " In k6, as in older Ks, padding will produce a string with an exact length, truncating if necessary: 2$"abcde" "ab" 6$"abcde" "abcde " Is this correct? / k4 6$"abcde" "abcde " 2$"abcde" "ab" / k2 6$"abcde" " abcde" 2$"abcde" "de"