Klong is an array language, like K, but without the ambiguity. If you know K or APL, you may be disappointed by Klong. If you don't know any array languages, it might explode your brain. Use at your own risk!
A Klong program is a set of functions that use powerful operators to manipulate lists (vectors) and (multi-dimensional) arrays. Here is a program that checks whether a number x is prime (for x>2):
Note that Klong is a mathematical notation rather than a programming language. If you try to use it like your favorite OO/functional/procedural programming language, you will only get frustrated. Here's an interactive explanation of the above program.
The Reference Manual (klong-ref.txt) provides a complete and detailed semi-formal description of the Klong language. It is probably the best starting point for exploring Klong.
The Quick Reference (klong-qref.txt) summarizes the syntax and semantics of the language. It will probably only make sense if you already know K or APL.
Then there is a Really Short Introduction to Klong (klong-intro.txt), which you might want to read if you have never used an array language before.
Finally, if you already know K, here is a (probably incomplete) summary of differences between Klong and K: klong-vs-k.txt
You can download Klong here: klong20170723.tgz (~105KB, recent changes).
Klong is written in pure ANSI C (C99), so it should compile on any
system providing a C compiler. Just run
To install Klong, just copy the
kg binary to
/usr/local/bin or some similar place and point the
KLONGPATH environment variable to the
directory of the Klong source tree.
Files ending in
.kg are Klong programs, you can load
./kg -l name (with or
without the suffix).