Live data from Hacker News

Arthur Whitney releases an open-source subset of K with MIT license

shakti.com

131–140 of 234 posts

Re: Arthur Whitney releases an open-source subset of K with MIT license

#131
post #121

Earlier quoted context omitted.

Thinking about problems and data manipulation in the way array languages enable is hard but, once you have pushed through the what feels like a barrier of mainstream programming language thinking that is stopping you from “grokking” it, it is a sudden moment of clarity and then you “get it”. Perhaps a half way house is sql. The difference between ORM-style CRUD and a power user using window functions to make the data…

Agreed. Pushing through until you can think in array languages is well worth it! In my experience one of the top 30 highest ROI mental circuits you can develop. That being said, I'm not convinced that the extremely minimal syntax is essential. I think it can be done another way ;)

Can you please share a few of the other 30 highest ROI mental circuits to develop?

Re: Arthur Whitney releases an open-source subset of K with MIT license

#132
I'm going to have to take another run at learning this corner of computing soon, but it's a prospect I'm not relishing. Everything about it rubs me up the wrong way.

If you'd like an antidote, have a read of Gerald Jay Sussman's books, where you'll see profound concepts from maths and physics captured in succinct and expressive (as opposed to merely terse) code, accompanied by eloquent explanations devoid of boasts or name dropping and provided free of charge online. That will change the way you think about computing too, but it will be a more pleasant experience.

Re: Arthur Whitney releases an open-source subset of K with MIT license

#134
For those who haven't heard of or aren't familiar with K, the Wikipedia page[1] has a remarkably helpful brief overview:

> K is a proprietary array processing programming language developed by Arthur Whitney and commercialized by Kx Systems. The language serves as the foundation for kdb+, an in-memory, column-based database, and other related financial products. The language, originally developed in 1993, is a variant of APL and contains elements of Scheme. Advocates of the language emphasize its speed, facility in handling arrays, and expressive syntax.

There was also a great thread on HN about it as well[2].

[1] https://en.wikipedia.org/wiki/K_(programming_language)

[2] https://news.ycombinator.com/item?id=28493283

Re: Arthur Whitney releases an open-source subset of K with MIT license

#135

FYI: This only implements a subset of K (I'd estimate 1/3). Calling it a 'release' is an overstatement. The docs state that it is a work in progress. It's also quite buggy (it's easy to get a segmentation fault). The version I saw in January was about 1/3 the size of this version, and also buggy. I hope that the final version of this code is less buggy and more usable. If you want to learn the K language, don't use t…

> Any of the other open source K projects are better than this (more complete, less buggy, better documented).

One thing that puzzles me, about array languages, is that despite several open source implementations already existing, like J, its surprisingly difficult to find them packaged in Linux repositories. For example, you can't just "apt install J", or "apt install gnu-apl" on Ubuntu. In J case, it seems the default is just compiling it from source. Is there something tricky about packaging them?

The closest to a repository-friendly array language I could find was the klongpy implementation of klong[0], that is pip installable.

[0]. https://t3x.org/klong/

Re: Arthur Whitney releases an open-source subset of K with MIT license

#136
Functionality is, at this time, extremely limited (and the first kfun was out in January so I don't think there's really any intention to get this to usability on a short timeframe). No support for paired syntax like parentheses, functions in braces, and square brackets for indexing and function calls. No stranding or tacit functions. I doubt it's Turing complete. Many primitives are unimplemented and others are flaky: for instance calling count (#) on an atom can give an arbitrary number, print garbage, segfault, or allocate memory until it's killed. But it's got vector instruction support.

If you're looking for a practical k implementation, I recommend ngn/k, and several other implementations are listed at https://k.miraheze.org/wiki/Running_K .

Re: Arthur Whitney releases an open-source subset of K with MIT license

#138
post #15
post #5

The code looks heavily obfuscated. It's more like "source available" than open source. E.g. g(_M,W-=1 i?_M(i,M_(i+1))+(2*n0 Edit: Looking at it a bit more, I can't tell if the code is obfuscated or if the author really wrote it like this...

That's the "Whitney style". See: https://code.jsoftware.com/wiki/Essays/Incunabulum It's writing C in array-language style rather than intentional obfuscation.

Personally I believe in a sort of "evolution" of software that operates independently of intentions of the programmers.

I can totally believe that he didn't intentionally obfuscate it, but its incomprehensibility made it harder for other people to make a knockoff and thats why it survived and became successful.

Re: Arthur Whitney releases an open-source subset of K with MIT license

#139

Earlier quoted context omitted.

And to be clear, in many, if not most cases, settling for "good enough" is the right call, and spending hours upon hours chasing performance is the wrong call.

Sure, but not in the case of maximising performance if that is your goal. Which is what we are talking about here… wringing every ounce of overhead from it is basically the business case; at least one of them.

Oh sure. Just wanted to stress that that's seldom the case. I see so many cases of wasted optimizations because someone thought performance mattered, leading to unnecessarily complex code or other maintenance issues.

In other cases, especially in my sector, it's simply that the customer values lower cost over absolute performance.

Of course, not saying you shouldn't be mindful of introducing an O(n^2) algorithm when an O(n log n) can trivially be used, or similar.

Re: Arthur Whitney releases an open-source subset of K with MIT license

#140
post #76

Earlier quoted context omitted.

Thanks for that link. The comments there help a lot. If I understand them, this is a minimal implementation of K with a lot of limitations, such as: "the only supported atom/vector type is 8bit integer, so beware of overflows" Still, it's fascinating how an interpreter can be written with such a small amount of code.

An interpreter for BLC, including tokenizing, parsing, and evaluation, can be written in as few as 29 bytes of BLC (and 650 bytes of C).

John, do tell more about BLC please!
Post reply on HN