K2 Reference Manual (1998)
4 points by veqq
4 points by veqq
Something I really want to do in my Copious Free Time is write an implementation of K2 in C.
(But like…my style of C. I want my C to look like C and my APL to look like APL but I get Whitney’s thesis…)
What makes an implementation of K2 more attractive than an implementation of K3, K4, K5, K6, K7 or K9? Ref: https://wiki.k-language.dev/wiki/Resources/By_Version and https://wiki.k-language.dev/wiki/Running_K
Note: I've played with K, but I am confused about the differences between all the many versions.
K2 and K3 are essentially the same language; minor revisions. K3 notably removed the "electric GUI" system.
K4 is the internal implementation language hidden inside of Q/Kdb+. It's a significant divergence from K3 in many ways and intentionally does not have official documentation.
K5/K6 were experimental testbed languages that Arthur Whitney never openly published, but binaries were available to selected individuals. They also have divergences from K3 but are closer to a progression from K3 than from K4. Lots of primitives were shuffled around and added or removed, but one of the biggest enhancements- in my opinion- is that K5 made dictionaries a fully general datatype, with arbitrary-type keys, overloads for many operators, and a conforming "algebra". It also never had complete documentation.
K7/K9 are another large set of divergences, and neither have been anywhere close to complete, stable, general-purpose releases. Among many other changes, K7 rearranged the symbols for adverbs and flirted with the use of unicode characters, making its intelligibility to K2-K6 programmers a bit of a leap.
K2 is a sensible choice for a ground-up reimplementation, because it has by far the most detailed reference manual. My K5/K6 interpreter started as K2, following this manual. I then "grew it" in the direction of K5 based on the scant information I could find online, and then later based on interactive reverse-engineering of the behavior of K5 and K6. Most of the people with professional experience in K today are either familiar with K2/K3, with K4, or with both.
It has the most comprehensive documentation that I have access to (a reference manual, a programmer’s guide, and an extension author’s reference), plus we know it’s stable (unlike, say, k9, which has several incompatible versions, including some from the same vendor)