in reply to What do you use as a language litmus?
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.
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....(f g) data => data f (g data)
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:fn data NB. function applied to data "NB. is comment in J"So when you see5 + 5 NB. 5 adds_to 5 5 , 6 NB. 5 appended_to 6 4 { 1 2 3 4 5 NB. 4th element_of the_list_12345the data f (g data) is Noun Verb Noun and is not like in perl where a function taking two arguments would have both nouns to the right of the verb.(f g) data => data f (g data)
Now three verbs in a row is called a fork. So
And that's what you need to know for the next section(f g h) data => (f data) g (h data)
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!avg =: +/ % #
% 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
(+/ data) % (# data) (sum-of data) divided-by (number-of-elems data) results in average
Falkoff and Iverson, The Design of APL, 1973. Falkoff and Iverson, The Evolution of APL, 1978. Iverson, A Personal View of APL, 1991.
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.
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.
|
|---|