Kona is a new open-source implementation of Arthur Whitney's K, an ASCII-based APL like language. Kona is a fully working version of K3.

If you haven't ever tried APL/J/K or ilk you might find this language incomprehensible at first -- unless you like a challenge! Watch the screencasts or read some of our earlier APL/J stories.

Regardless of your interest in K, any LtUer worth his salt will enjoy the source code. We wrote a bit about the history of the remarkable C coding style used in the past, but I can't locate the link at the moment.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Hopefully he doesn't take it too far. I was threatened with legal action for making an open source interpreter too much like q (their "friendlier" layer on top of k).

"Enjoy" is not the word I'd use...

...but I agree that it's completely inevitable for anyone who's used to writing code in APLish languages to use this style in C as well. I wonder what went wrong in the "mt.c" file; surely it could have been called "m.c", parallel to all the others?

mt.c for "mersenne twister".

mt.c for "mersenne twister". It probably would have been "r.c" ("random"), but it was already taken.


This tutorial will help in deciphering k3.

As for the coding style, perhaps you are referring to what's in Appendix A of http://keiapl.org/rhui/remember.htm

Another intro

jjayson's "Shallow Intro" to K seems to be targeted at just the right version.

I've found that particularly helpful while getting up to speed (and writing some basic of Kona's docs).

And yes, the "J Incunabulum" is an accurate example of APLer C.

Re: Another intro

Arthur's one-page fragment was also a big influence on Kona.

I spent a few minutes

I spent a few minutes translating Whitney's interpreter fragment into more conventional C style. I was kind of disappointed at how normal the resulting code was, honestly -- I was hoping for Duff's device-y magic. :)

Not surprising. K is fairly

Not surprising. K is fairly conventional. Anon functions but not nested ones. No nested scope (just global and local). Args are passed by value. No cyclic structures (refcount GC is fine). Currying. What is "magic" is how well the parts fit! Array programming, choice of builtin verbs (functions) and adverbs (functions that take function args) and very good support for file and network IO. You can get a lot done with a minimum fuss. A pleasure to use.


This is great: "...the APL paradigm is so powerful that it usually pushes aside alternative thoughts"