The J Language

I have been experimenting with this programming language called J.  J is a full featured programming language capable of doing anything your more conventional language do.  What makes J different is how it approaches solving problems.  All functions (called verbs in J) can be applied to any n-dimensional array.  This ability to consume large sets of data in the same way as single values makes for some concise (and dense) solutions.

One such example I saw was this function which finds the mean of a list of numbers:

mean =: +/%#

So far in my readings I am able to understand that much but I came across a implementation of quick sort that looks like this:

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)

I have no clue at all yet what the hell that is doing.  But hopefully i’ll eventually get there.

At first I was skeptical about the value of a language like J (or APL the predecessor of J).  After playing with it though I am convinced of its power but I still question its maintainability.  It is really cool how short and concise your programs can be but if you go back to update it in a year will you (or someone else) be able to know what is going on.  Every tutorial I read says something along the lines of “once you get used to it you can read it super easily”  however I am still questioning that.  I have used regular expression for a long time and they still take me a long time to parse what they are doing. I don’t see J as being much different.  But I am sticking with it for now and I will see if I encounter an epiphany and suddenly be able read and understand J easily :)