Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Attack of the one-letter programming languages

Peter Wayner | Nov. 25, 2014
Watch out! The coder in the next cubicle has been bitten and infected with a crazy-eyed obsession with a programming language that is not Java and goes by the mysterious name of F. The conference room has become a house of horrors, thanks to command-line zombies likely to ambush you into rewriting the entire stack in M or R or maybe even -- OMG -- K. Be very careful; your coworkers might be among them, calm on the outside but waiting for the right time and secret instructions from the mothership to trash the old code and deploy F# or J.

R on the Web:

One-letter programming language: J

Once upon a time, a manager counted the lines of software coming out of the cubicle farm and determined that programmers wrote N lines of code a day. It didn't make a difference what language was used — the company would get only N lines out of them. The manager promptly embraced APL, the tersest, most powerful language around, created by IBM for manipulating large matrices of numbers, complete with special characters representing complex functions for further terseness.

Along the way, everyone got tired of buying special keyboards from IBM, but they loved the complex functions that would slice and dice up big matrices of data with a few keystrokes. J is one of the spinoffs that offers the power of APL, but with a normal character set.

If you have vast arrays of data, you can choose one column and multiply it by another with a few characters. You can extract practically any subset with a few more characters, then operate on it as if the complex subset were a scalar. If you want to generate statistical abstracts, the creators of J have built large libraries full of statistical functions because that's what people do with big tables of data.

J on the Web:

One-letter programming language: K

J is not the only sequel to try to bring APL to a bigger audience by remapping everything to a standard keyboard. K comes from a different group, the crew that first built A, then A+. After that, they jumped inexplicably to the letter K, which offers many of the same extremely powerful constructs for crushing vectors and multidimensional arrays. You can express extremely elaborate algorithms for working with arrays in a few keystrokes.

It's worth marveling at the stark power of this one-line program to find all prime numbers less than R. It's barely even half a line:


In fact, it's less than half a line — it's exactly 21 characters. You could probably pack a K program for curing cancer into a single tweet. If you're crunching large multidimensional arrays of business data into answers, you can save your fingers a lot of work with K.

K on the Web:

One-letter programming language: G

A number of projects lay claim to the letter G, but one popular option differentiates itself from the pack in very interesting ways. While people talk about the Internet of things as if it were entirely new, G programmers have been using their code to build physical items from the beginning. The language is widely used to control the milling machines that turn a block of metal, wood, or plastic into an object.


Previous Page  1  2  3  4  5  6  Next Page 

Sign up for CIO Asia eNewsletters.