KenIverson created the AplLanguage while at IBM. After leaving IBM, he created (with Roger Hui) a follow-on called "J". J has all the elegance of apl and more, without using those weird characters that made apl infamous (ASCII only). Anyone interested in patterns should learn this language. It will take a week of evenings to grok. Then study the included JayPhraseBook and try to imagine what the same would look like in smalltalk, c++ or vb. -- WardCunningham * We used to sell APL by showing people the source code for a program to calculate the sum of a set of numbers in three different languages; COBOL (180+ characters), Fortran (100+ characters), APL (exactly 8 keystrokes). Not a fair test, but certainly a feature if, like me, you type with three fingers, a fist and an occasional elbow. -- hwo * ''Ah, the ol' ArgumentViaLabToy ploy.'' (The J system is available from http://www.jsoftware.com, while the documentation is at http://www.jsoftware.com/publications_books.htm) Also see JayCriticisms, KayLanguage. ---- A J program took the judges' prize in the 1998 IcfpProgrammingContest. * http://www.ai.mit.edu/extra/icfp-contest/ -- contest information * http://www.ai.mit.edu/extra/icfp-contest/winners.html -- winners * http://www.ai.mit.edu/extra/icfp-contest/isi.html -- about the J entry ---- J Software has offered a free license key for J version 4.02a for Win CE. A version tailored for CE 3.0 (Pocket PC) has been promised, but this earlier CE version software runs well (but with a few interface snags introduced by CE version 3.0) on a Pocket PC. (I have it on my HP Jornada 540, and have been having great fun playing with it.) And great news - J 4.05a (for windows and unix), currently in beta, also is planned to be available at no charge - the professional license (a modest charge for serious corporate use) is required only to enable some development grade features (debugger, etc.), but the free license allows use, program development, and distribution of complete J solutions. As always, full documentation is also available at no charge from the J Software website (linked above). The two week or so trial key previously available was hardly enough time to get a serious feeling for and appreciation of the language (in spite of Ward's ability to grok it in a week of evenings.) I expect this move will generate a much wider use and respect for the language. ''Update: J4.05a has been released, and as promised, is free. Get it from http://www.jsoftware.com'' ''Update Update (8/2/01): J406b is available, including a free version for Windows CE (PocketPc). '' -- JimRussell March 2011: J is now available as FreeSoftware, under the GplVersionThree of the GeneralPublicLicense. Proprietary licenses are also still available. http://www.jsoftware.com/source.htm July 2012: Now available for the iPhone in the app store! ------- A weekend with J is a great antidote for that sick feeling one gets seeing yet another Java book. The computational ideas behind J have been smoldering for decades. Now with a 400 MHz, 128 Mb laptop they really catch fire. (...400MHz, that's soo 2 years ago.) ----- Calculating in a spread sheet is a lot different from calculating in an ordinary language like C, Java or Visual Basic. Calculating in J is equally different, but in a more powerful direction. ------ Is J an ArrayOrientedLanguage? Can JayLanguage be used like AplLanguage? Aside from PocketPc, is there a stable freeware version for WindowsXp, consisting of a half decent database interface (e.g. even ODBC )? Are there Commercial interests in the use of Jay, as at early 2004? Please''''''AnswerMe. Thanks from DavidLiu J is a dialect of APL. Aside from the switch from the APL character set to ascii, much of the language is backward compatible with APL. ---- Here, I will try to give you the feel of J while making up my own (less elegant) notation. J has functions, like sqrt, which it calls verbs. An interesting thing about sqrt is that when repeatedly applied the result approaches 1. (This is a math fact, not a J related property.) sqrt(2) ==> 1.41421 sqrt(sqrt(2)) ==> 1.18921 sqrt(sqrt(sqrt(2))) ==> 1.09051 J also has operations on functions which it calls adverbs. We can use an adverb to repeatedly apply sqrt. sqrt^:1(2) ==> 1.41421 sqrt^:2(2) ==> 1.18921 sqrt^:3(2) ==> 1.09051 Here the exponents 1, 2 and 3 are applied to the verb sqrt, not its argument. The notation is handy if one wants a large or variable exponent. sqrt^:10(2) ==> 1.00068 N := 10 sqrt^:N(2) ==> 1.00068 Of course, in Java, we could do the same thing with a loop. double x = 2; for (int i=1; i<=10; i++) { x = sqrt(x); } Java will check types for us but it no longer "understands" what we are doing. J can do better. * A better implementation can be made using HigherOrderFunction; it's not hard in any FunctionalProgrammingLanguage to write a HOF that takes a function ''f'' and an integer ''n'' as arguments, and generates another function ''g'' that calls ''f'' ''n'' times. Because it understands the notion of repeatedly applying a function it can generalized this to repeatedly unapplying them too. (Note: J uses _ to represent negative in numerals.) sqrt^_1(2) ==> 4 A function raised to the _1 power is called the inverse. The inverse of sqrt is square. The square of 2 is 4. Exponents of _2 and _3 have the obvious meaning also. sqrt^_2(2) ==> 16 sqrt^_3(2) ==> 256 * Given a function, how does one specify its inverse? Many functions out there are non-invertible (the function is not one-to-one, or computation of the inverse is intractable or undecideable. And if J is given an expression like sqrt^5 (sqrt^2 (sqrt^-1(x))), does it reduce it to sqrt^6(x) before computing? This sort of LazyEvaluation might be useful if some intermediate term were undecideable, but by suitable mathematical ReFactor''''''ing one could eliminate the undecideable term(s) and produce a computable result. ** I just tested this with J 6.01 using the expression (sqrt^:5)(sqrt^:2)(*: i.1000000) and timed it against simply stating (sqrt^:6 i.1000000). Both times came out exactly the same; therefore suggesting that J, while NOT a lazy evaluation language, does manipulate functions algebraically before fully evaluating them in some cases. --SamuelFalvo It probably uses the secant method to approximate an inverse, not algebraic manipulation. -- ScottVokes J can invert many of its verbs and a lot of the verbs you write too. This may seem like a trick you would never use. I think otherwise. Soon you will begin manipulating verbs as if they were numbers. J calls this programming. sqrt^_1 ==> square mean ==> arithmetic mean sqrt mean square ==> root-mean-square (RMS) average (Note: J cannot invert all verbs, and verbs you write may need to be written carefully so as to allow them to be automatically inverted.) J recognizes the common idiom of pre- and post-processing by a function and its inverse and offers an appropriate adverb, one made possible by the general ability to invert functions. mean &. square ==> root mean square (RMS) average By the way, RMS averages are bread and butter for electrical engineers. Net present value is another version of average easily constructed in J and more useful to the financial engineers among us. The hardest part of learning J is learning patterns that don't exist in ordinary programming languages. It's hard, but it is also fun. KenIverson has written all manner of introductions, tutorials and online help. Now, with unlimited free distribution, we can learn these patterns and apply them at will. My advice: keep a copy of J on your laptop even if you still do most of your programming in Java. -- WardCunningham http://c2.com/wiki/jrms.txt -- J typescript of these calculations ------ As shown in the link above, the actual J notation to apply the verb sqrt (itself the verb %:) to the argument x (2) n times is (sqrt ^: n) x. But since J works with arrays, rather than running the expression with individual values of n, a vector value of n (n=: 1 2 3) yields all three results: sqrt =: %: (sqrt ^: 1 2 3) 2 1.41421 1.18921 1.09051 or, with a vector x argument: (sqrt ^: 1 2 3) 2 3 4 1.41421 1.73205 2 1.18921 1.31607 1.41421 1.09051 1.1472 1.18921 all verified using J on my HP 540 PocketPC. -- JimRussell ----- J, like APL before it, prefers to use symbols for built in functions, not names. If you prefer names, it is easy enough to define them as in "sqrt =: %:" above. Unlike APL, however, J does not require a special keyboard to type all of the symbols. Instead they are constructed from normal ascii symbols. The number of symbols available is extended by augmenting (dotting) a single ascii symbol with either a period (.) or a colon (:). This means you will see a lot of dots and colons in a J program. Dotted symbols usually name related functions ... * = is equality, =. is assignment, =: is global assignment * % is reciprocal, %. is matrix inversion, %: is square root Also, each operator has a monadic and dyadic form, again closely related ... * %: 2 is sqrt of 2 * 3 %: 9 is cube root of 9 In addition to verbs, J's symbols also represent adverbs (which modify the behavior of verbs) conjunctions (which join, e.g., verbs with nouns) and gerunds (sort of a case statement for verbs). One of the few programing languages that is also an AgglutinativeLanguage. ---- Some new JayUserIdeas are being collected in an experiment to see if this might be a good way to augment the documentation of J. (It didn't prove to be, and there has been essentially no activity associated with this since the page was created.) -- DavidNess ------- It would be interesting to see a more approachable version of these kinds of languages. It may verbosify them a bit to make them more approachable, but the benefit is that there would be more users and thus a bigger support community and more tool options and more corporate approval. A functional style for operators instead of (or in addition to) symbols (%$#, etc.), along with SQL-like predicates may be helpful. ----- See also: CollectionOrientedProgramming SelfNumbersInJayLanguage ----- CategoryProgrammingLanguage