|laziness, impatience, and hubris|
Re: What do you use as a language litmus?by princepawn (Parson)
|on Jun 26, 2007 at 15:34 UTC||Need Help??|
It is a successor to APL and is remarkably concise. It is also a highly functional language. It has computer language counterparts to English parts of speech such as noun, verb, adverb, gerund, and conjunction. Besides concise operators, there is one concept, called verb rank, which went through more than 10 years of development and research to develop. It has a long history of development. I will now give a small taste of each of my overview statements.
descriptive, not proscriptiveIn a descriptive language, it is convenient to describe a macroscopic action as opposed to proscriptive, where you must do each little part. I spent a good amount of time dabbling in Factor, a stack-based language before getting exasperated with the proscriptive nature of it. I had to continually focus on manipulating a stack as opposed to focusing on the problem at hand.
J is descriptive in a number of ways, but I will only go over one that is necessary to read the next section. It has to do with a concept called "verb trains"... In most languages, a series of functions implies function composition. In J, two functions in series applied to data gets rewritten like so:
which means that f is a binary function which will take the pure data and the result of g data and operate on that. ... here we must note something else....
a brief aside
J verbs (functions) are monadic, dyadic, or ambivalent (meaning they have implementations for both monad and dyad cases). The monadic case looks normal:What this means is that the common operation of copying data before operating on it, and then using the original and modified data on another function is highly descriptive.but the dyadic case is just like in English sentences where you have Subject Verb Object:
Now three verbs in a row is called a fork. So
And that's what you need to know for the next section
highly conciseJ took the judge's prize in the 1998 ICFP programming contest. It ran faster than 17 compiled C entries. And is "astoundingly brief" --- only 113 lines and only contained one loop thanks to the fact that all operators have implicit looping capabilities.
Check out this J code to average a list of numbers:
+/ means to insert + between each member of a list... and the neat thing is that / is an adverb that can be applied to any verb. so / is a function which takes a verb as a function to produce a new verb!
% is simple. It divides 2 numbers
# is simple. It counts the number of elements in a list
So remember that a train of verbs gets rewritten? So basically what we have is
the rest of JWell, I'm a bit tired, and I havent really given a balanced overview like I meant to. Personally, I'm addicted to J and keep coming back for more. The J Bibliography is a great place to read on the origin of ideas behind APL and J as a certain way of looking at programming which puts conciseness at a premium. In particular see:
Also Ken E. Iverson memoriam page has plenty of insight to APL and J language culture.
It's a very different language. And it will make you think differently, but I am enjoying my time with it.
The ConsThe cons about this language is the small community and lack of enterprise-ready deliverables/libraries. For instance, they are just now trying to get parsing of multipart form data to work properly.
Now even though the community is small, you can check the mailing list archives to see that there is a tremendous amount of activity amongst the small userbase.
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality