K programming language

From Free net encyclopedia

Revision as of 16:28, 10 April 2006; view current revision
←Older revision | Newer revision→

K is a high level array programming language developed by Arthur Whitney, an influential APL programmer.

K is a successor of the Morgan Stanley financial language A+, also created by Whitney. From 1994 to 1997 the Union Bank of Switzerland purchased exclusive rights for the use of K, but it has since been generally available. It is free for non-commercial use, but otherwise a license is required. K is produced by Kx systems.

K is designed to be a good language for dealing with mathematical analysis, financial prediction, and large volumes of spreadsheet-like data. Emphasizing efficiency and simplicity for practical numerical calculations, K aims to combine the best of APL, C, and Lisp.

Unlike other members of the APL family, K has been built with ASCII from the ground up. Because of the decreased number of characters this makes, K relies heavily on overloading. Additionally, many built-in commands require multiple characters, more often than in earlier APL dialects.

The GUI library included in K is based on that of A+, but it takes advantage of many features unique to K. K's GUI is declarative and data-driven, as opposed to most GUIs which are imperative. A window and the things in a window are contained in a normal data structure, usually a dictionary on the K Tree, and displayed with the $ operator (which doubles as a formatting operator and a casting operator, too). Information about a widget is kept in the variable's attributes. Every data type in K can function as a widget--just not necessarily very well.

Hello world in K is

`0:"Hello World\n"

But in K, the GUI library is so terse and easy to use that even for prototyping, developers often use a GUI interface rather than a command line. A minimal, not very pretty GUI hello world in K is

`show$"Hello world"

That's only one more character than on the command line!

External links