12 ms·
K Fragments
- smabie 7y agoOff topic, but does anyone know if Shakti is going to have a q like interface? I was under the impression that Whitney decided that having operators that can be both monadic and dyadic was a bad idea?
- JadeNB 7y agoWhat is Shakti?
- smabie 7y agohttps://shakti.com/ https://shakti.com/ It's the next evolution of kdb+/q.
- jxy 7y agoYou can get the binary releases here, https://anaconda.org/shaktidb/shakti/files https://anaconda.org/shaktidb/shakti/files
- ColanR 7y agoWhat limitations are there with those releases?
- the_optimist 7y agoIt's highly restrictive. If you like array languages, you should use J. It is a superior general-purpose language with GPL licensing. https://www.jsoftware.com https://www.jsoftware.com vs. https://shakti.com/license.php https://shakti.com/license.php Subject to Customer’s ongoing compliance with this Agreement, Shakti hereby grants to Customer a non-exclusive, non-commercial, non-transferable, non-sublicensable, revocable, limited license for a period of 30 days (the "Evaluation Period") to download, install and run the Software for Customer’s evaluation purposes and for internal, non-commercial use only.
- ColanR 7y agoEh. The performance and the notation is important to me, and I haven't seen a lot of benchmarks (or any...) indicating that J is particularly fast. And from what I understand, even Iverson eventually decided that J was a step backward from his notation-first APL. But mostly what I'm wondering is if those downloads are 32bit-only, or time-limited in the software, or memory limited, or if it's a winzip-esque honor system limitation. Not as interested in the license.
- smabie 7y agoI don't know about shakti, but kdb+/q has two different free versions. The 32-bit version is unlimited and you can use it for commercial stuff. The only restriction is that you can't run it on the cloud (whatever that means). The 64bit version is non-commercial and you must have an active internet connection to use it. In practice, I haven't found the 32bit version to be very limited, since you can still do IPC very easily.
- otoburb 7y ago>>The 32-bit version is unlimited and you can use it for commercial stuff. The only restriction is that you can't run it on the cloud (whatever that means). The software license agreement for the 32-bit version specifies non-commercial use, and also still has the software time-out clause where Kx "reserves the right to insert a time-out function into the 32 Bit Kdb+ Software that will cause it to halt after a specific period of time (e.g. two hours), requiring the software to be re-started."[1] [1] https://kx.com/download/ https://kx.com/download/
- jxy 7y agoYou won’t see any real performance comparisons because any benchmark related to kdb+ is completely restricted by its company. J without the database (Jd) is dual licensed with gpl as an option, so you can try to compare the base language by yourself for your application. But Jd again is free only for non-commercial use only. Those shakti downloads seems to be fully functional.
- alfalfasprout 7y agoAny idea if there's documentation anywhere?
- smabie 7y agohttps://kcc.kparc.io/ https://kcc.kparc.io/
- ISL 7y agoFor those of you fluent in K, when you glance at these, is their function apparent, or do you have to sit down and diagram them out?
- RodgerTheGreat 7y agoVaries. I think among these examples "is interleave?" and "limit run length" require some thinking, or a bit of playing in the REPL. Most of them are pretty easy to follow, though.
- watersb 7y agoCan someone tell me what K is about? Looks interesting, is new to me. I have been thinking about my use of Perl, shell scripts, (I used to live in Bash) learning PowerShell this week. My solutions tend to converge towards heavily-commented one-liners. Then I read Wolfram's 12.1 release note; Mathematica started as a Lisp for maths. Stephen Wolfram writes these exasperating things of polished beauty that seem incomprehensible without pages of notes.
- RodgerTheGreat 7y agoK is a vector language. There is indeed some overlap in ideas with Mathematica and Lisp, but it draws most heavily from APL. There are a handful of decent open-source or at least freely available interpreters online: https://ngn.bitbucket.io/k.html https://ngn.bitbucket.io/k.html
- smabie 7y agoI would recommend getting started with q, instead of k. q is a lot easier to get started with and after you learn the basics (takes maybe a day or two), learning k is much easier. A good resource is: https://code.kx.com/q4m3/ https://code.kx.com/q4m3/ k/q aren't actually very difficult to learn, you can memorize the entire language in a period of a day, maybe. The hard part is actually writing good code with it. I could spend the rest of my life programming in k and never be 1/10th as good as Arthur Whitney (the creator).
- short_sells_poo 7y agoSo this: > {.+(k;({x@&~_n~/:x}x@')'k:?,/!:'x)} Turns a list of dictionaries to a dictionary of lists. It is clearly amazingly expressive as you can do so much in just half a line of code. However, for someone not used to APL, this is utterly and totally unreadable. I can pick pretty much any ML derivative, C-style or lisp language and make heads and tails of most code, but with the above line I don't even know where to start. Might as well be hieroglyphs :)
- RodgerTheGreat 7y agoSorry. This page wasn't really written as an introduction; more a collection of ideas. To break that example down for you, the outer {} indicate that this is an anonymous function. It is implicitly a function over a single argument named "x"; our list of dictionaries. Expressions read right to left, so the first semantic unit is: k:?,/!:'x The variable "k" gets the distincts (?) of the concatenate-reduction (,/) of the keys (!:) of each (') dictionary: !:'x (,`a ,`b `a `b) ,/!:'x `a `b `a `b ?,/!:'x `a `b The other embedded lambda "{x@&~_n~/:x}" is read as "x indexed (@) by where (&) not (~) null (_n) matches (~) each-right (x)"; it filters nulls from a list. _n~/:(22;;33;55) 0 1 0 0 ~_n~/:(22;;33;55) 1 0 1 1 &~_n~/:(22;;33;55) 0 2 3 {x@&~_n~/:x}(22;;33;55) 22 33 55 Then the overall construction "{x@&~_n~/:x}x@'/:k" can be understood as "reach into each dictionary with all the keys and filter them to non-null values". Now you have a list of lists of values in the order that the keys appeared. Finally, ".+(k; ... )" joins our keyset with the values we found for each key. Make dictionary (.) from the transpose (+) of the pair of vectors (k;v). Does that help?
- cptnapalm 7y agoAt a glance, I would think someone was programming using just regular expressions. Or maybe speech-to-text translation of line noise.
- deleted 7y ago[deleted]
- kazinator 7y ago
- maest 7y agoIt's so weird having one k post a day, like clockwork.
- smabie 7y agoI think people are getting excited by Shakti (or maybe it's coordinated?). I'm hoping array programming is going to break into the mainstream, it's remarkable that even many experienced programmers know nothing about array languages. And when exposed, most just dismiss them out of hand as 'unreadable' or 'line-noise.'
- theamk 7y agoArray programming is already mainstream -- matlab, python/numpy, R are used daily. The first time one does it, it is very enlightening -- "what do you mean I can operate on millions of entries without loops"? The only thing which is unclear is why would one want to use unreadable line-noise languages for that.
- yiyus 7y ago> The only thing which is unclear is why would one want to use unreadable line-noise languages for that. I find this attitude unrespectful and not very productive. In all these threads, many of us try to explain why we find this way to write software convenient, readable, and powerful. Then, people who do not even consider giving it a try, make comments like yours. This does not create a good atmosphere. If you are not interested, move on to another story. If you really want to understand it, you will need to invest some time, and we will be glad to answer any question.
- theamk 7y agoI like array programing, and I think that it is an extremely nice and convenient tool for the right task. The grandparent is right, “it's remarkable that even many experienced programmers know nothing about array languages”. I wish more people learned about them! And that is precisely why I find statements like “I'm hoping array programming is going to break into the mainstream” very annoying - it is not 1970’s anymore, you don’t get to pretend your only options are APL or write matrix multiplication by hand, every time. There are entire university departments full of people who only know matlab. You cannot just pretend they don’t exist. I wish there was an modern tutorial which compares K to something like numpy or matlab.
- darkkindness 7y agoIf this was interesting, check out Eugene McDonnell's "1000 K idioms" (in k2): https://web.archive.org/web/20071230205056/http://kx.com/technical/contribs/eugene/kidioms.html https://web.archive.org/web/20071230205056/http://kx.com/tec...