Google
 
   
Login
Username:

Password:


Lost Password?

Register now!
Search
Main Menu
service
top books
Polls
What do you think about php-deluxe.net?
Excellent!
Cool
Hmm..not bad
What the hell is this?
encyclopedia
recommendation
Freenet DSL
Who's Online
11 user(s) are online (8 user(s) are browsing encyclopedia)

Members: 0
Guests: 11

more...
partner

J programming language

The J programming language, developed in the early 90 s by Kenneth_Iverson and Roger_Hui, is a synthesis of APL programming language (also by Iverson) and the FP programming language and FL programming language functional programming languages created by John Backus (of Fortran, Algol programming language, and Backus-Naur_form fame).

To avoid the problems faced by the special character set of APL, J requires only the basic ASCII character set, resorting to the use of dot and colon characters to extend the meaning of the basic characters available.

Being an array programming language, J is very terse and powerful, and is often found to be useful for mathematical and statistical programming, especially when performing operations on matrix_(mathematics).

Like the original FP/FL languages, J supports function-level programming (also known as higher-order functional programming ), via its tacit programming features (note that function-level programming is not the same as functional programming).

Unlike most languages that support object-oriented programming, J s flexible hierarchichal Namespace scheme (where every name exists in a particular locale ) can be effectively used as a framework for both class-based programming and prototype-based programming object oriented programming.

J is a non-Von Neumann programming languages that nevertheless allows the programmer to use von Neumann programming style when desired.

Note that the J programming language is not related to Visual J plus plus (and its new version J#), a version of Java programming language developed by Microsoft.

= Examples =

J is an extremely powerful language, and its programs can be very terse but even more cryptic.

The hello world program in J is

Hello, world!

This implementation of hello world reflects the traditional use of J -- programs are entered into a J interpreter session, and the results of expressions are displayed. It s also possible to arrange for J scripts to be executed as standalone programs, but the mechanisms for associating a script with the interpeter are system dependent. Here s how this might look on a unix system:

#!/bin/jc echo Hello, world! exit

But, many accomplished J programmers never resort to such mechanisms.

Here s a J program to calculate the average of a list of numbers:

avg =. +/ % # avg 1 2 3 4 2.5

# - counts the number of elements in the string. +/ - adds up all the elements in the string. % - divides the sum of the elements by the number of elements.

Now lets generate some random numbers and find the average:

a =. 20$100 a 31 16 60 64 64 71 13 3 76 26 25 77 68 48 42 91 99 97 99 9 avg a 53.95 Here is an implementation of quicksort, from the J Dictionary:

sel=: adverb def x. # [ quicksort=: verb define if. 1 >: #y. do. y. else. (quicksort y. sel e=.y.{~#y. end. )

The following expression (thanks to Roger Hui) computes n digits of pi and demonstrates the extended precision capabilities of J:

n=.50 NB. set n as the number of digits required : [http://jsoftware.com/books/help/dictionary/d022.htm Increment • Larger Or Equal] |- | nowrap | _ [http://jsoftware.com/books/help/dictionary/d030.htm Negative Sign / Infinity] | nowrap | _. [http://jsoftware.com/books/help/dictionary/d031.htm Indeterminate] | nowrap | _: [http://jsoftware.com/books/help/dictionary/d032.htm Infinity] |- | nowrap |   |- | nowrap | + [http://jsoftware.com/books/help/dictionary/d100.htm Conjugate • Plus] | nowrap | +. [http://jsoftware.com/books/help/dictionary/d101.htm Real / Imaginary • GCD (Or)] | nowrap | +: [http://jsoftware.com/books/help/dictionary/d102.htm Double • Not-Or] |- | nowrap | * [http://jsoftware.com/books/help/dictionary/d110.htm Signum • Times] | nowrap | *. [http://jsoftware.com/books/help/dictionary/d111.htm Length/Angle • LCM (And)] | nowrap | *: [http://jsoftware.com/books/help/dictionary/d112.htm Square • Not-And] |- | nowrap | - [http://jsoftware.com/books/help/dictionary/d120.htm Negate • Minus] | nowrap | -. [http://jsoftware.com/books/help/dictionary/d121.htm Not • Less] | nowrap | -: [http://jsoftware.com/books/help/dictionary/d122.htm Halve • Match] |- | nowrap | % [http://jsoftware.com/books/help/dictionary/d130.htm Reciprocal • Divide] | nowrap | %. [http://jsoftware.com/books/help/dictionary/d131.htm Matrix Inverse • Matrix Divide] | nowrap | %: [http://jsoftware.com/books/help/dictionary/d132.htm Square Root • Root] |- | nowrap |   |- | nowrap | ^ [http://jsoftware.com/books/help/dictionary/d200.htm Exponential • Power] | nowrap | ^. [http://jsoftware.com/books/help/dictionary/d201.htm Natural Log • Logarithm] | nowrap | ^: [http://jsoftware.com/books/help/dictionary/d202n.htm Power] |- | nowrap | $ [http://jsoftware.com/books/help/dictionary/d210.htm Shape Of • Shape] | nowrap | $. [http://jsoftware.com/books/help/dictionary/d211.htm Sparse] | nowrap | $: [http://jsoftware.com/books/help/dictionary/d212.htm Self-Reference] |- | nowrap | ~ [http://jsoftware.com/books/help/dictionary/d220v.htm Reflex • Passive /] [http://jsoftware.com/books/help/dictionary/d220n.htm EVOKE] | nowrap | ~. [http://jsoftware.com/books/help/dictionary/d221.htm Nub •] | nowrap | ~: [http://jsoftware.com/books/help/dictionary/d222.htm Nub Sieve • Not-Equal] |- | nowrap | | [http://jsoftware.com/books/help/dictionary/d230.htm Magnitude • Residue] | nowrap | |. [http://jsoftware.com/books/help/dictionary/d231.htm Reverse • Rotate (Shift)] | nowrap | |: [http://jsoftware.com/books/help/dictionary/d232.htm Transpose] |- | nowrap |   |- | nowrap | . [http://jsoftware.com/books/help/dictionary/d300.htm Determinant • Dot Product] | nowrap | .. [http://jsoftware.com/books/help/dictionary/d301.htm Even] | nowrap | .: [http://jsoftware.com/books/help/dictionary/d301.htm Odd] |- | nowrap | : [http://jsoftware.com/books/help/dictionary/d310n.htm Explicit /] [http://jsoftware.com/books/help/dictionary/d310v.htm Monad-Dyad] | nowrap | :. [http://jsoftware.com/books/help/dictionary/d311.htm Obverse] | nowrap | :: [http://jsoftware.com/books/help/dictionary/d312.htm Adverse] |- | nowrap | , [http://jsoftware.com/books/help/dictionary/d320.htm Ravel • Append] | nowrap | ,. [http://jsoftware.com/books/help/dictionary/d321.htm Ravel Items • Stitch] | nowrap | ,: [http://jsoftware.com/books/help/dictionary/d322.htm Itemize • Laminate] |- | nowrap | ; [http://jsoftware.com/books/help/dictionary/d330.htm Raze • Link] | nowrap | ;. [http://jsoftware.com/books/help/dictionary/d331.htm Cut] | nowrap | ;: [http://jsoftware.com/books/help/dictionary/d332.htm Word Formation •] |- | nowrap |   |- | nowrap | # [http://jsoftware.com/books/help/dictionary/d400.htm Tally • Copy] | nowrap | #. [http://jsoftware.com/books/help/dictionary/d401.htm Base 2 • Base] | nowrap | #: [http://jsoftware.com/books/help/dictionary/d402.htm Antibase 2 • Antibase] |- | nowrap | ! [http://jsoftware.com/books/help/dictionary/d410.htm Factorial • Out Of] | nowrap | !. [http://jsoftware.com/books/help/dictionary/d411.htm Fit (Customize)] | nowrap | !: [http://jsoftware.com/books/help/dictionary/d412.htm Foreign] |- | nowrap | / [http://jsoftware.com/books/help/dictionary/d420.htm Insert • Table] | nowrap | /. [http://jsoftware.com/books/help/dictionary/d421.htm Oblique • Key] | nowrap | /: [http://jsoftware.com/books/help/dictionary/d422.htm Grade Up • Sort] |- | nowrap | [http://jsoftware.com/books/help/dictionary/d430.htm Prefix • Infix] | nowrap | . [http://jsoftware.com/books/help/dictionary/d431.htm Suffix • Outfix] | nowrap | : [http://jsoftware.com/books/help/dictionary/d432.htm Grade Down • Sort] |- | nowrap |   |- | nowrap | [ [http://jsoftware.com/books/help/dictionary/d500.htm Same • Left] | nowrap |   | nowrap | [: [http://jsoftware.com/books/help/dictionary/d502.htm Cap] |- | nowrap | ] [http://jsoftware.com/books/help/dictionary/d500.htm Same • Right] | nowrap |   | nowrap |   |- | nowrap | { [http://jsoftware.com/books/help/dictionary/d520.htm Catalogue • From] | nowrap | {. [http://jsoftware.com/books/help/dictionary/d521.htm Head • Take] | nowrap | {: [http://jsoftware.com/books/help/dictionary/d522.htm Tail •]   {:: [http://jsoftware.com/books/help/dictionary/d523.htm Map • Fetch] |- | nowrap | } [http://jsoftware.com/books/help/dictionary/d530n.htm Item Amend • Amend] | nowrap | }. [http://jsoftware.com/books/help/dictionary/d531.htm Behead • Drop] | nowrap | }: [http://jsoftware.com/books/help/dictionary/d532.htm Curtail •] |- | nowrap |   |- | nowrap | J_programming_language_rank | nowrap | . [http://jsoftware.com/books/help/dictionary/d601.htm Do • Numbers] | nowrap | : [http://jsoftware.com/books/help/dictionary/d602.htm Default Format • Format] |- | nowrap | ` [http://jsoftware.com/books/help/dictionary/d610.htm Tie (Gerund)] | nowrap |   | nowrap | `: [http://jsoftware.com/books/help/dictionary/d612.htm Evoke Gerund] |- | nowrap | @ [http://jsoftware.com/books/help/dictionary/d620.htm Atop] | nowrap | @. [http://jsoftware.com/books/help/dictionary/d621.htm Agenda] | nowrap | @: [http://jsoftware.com/books/help/dictionary/d622.htm At] |- | nowrap | & [http://jsoftware.com/books/help/dictionary/d630n.htm Bond /] [http://jsoftware.com/books/help/dictionary/d630v.htm Compose] | nowrap | &. [http://jsoftware.com/books/help/dictionary/d631.htm Under (Dual)] | nowrap | &: [http://jsoftware.com/books/help/dictionary/d632.htm Appose] |- | nowrap | | nowrap |&.: [http://jsoftware.com/books/help/dictionary/d631c.htm Under] |- | nowrap | [http://jsoftware.com/books/help/dictionary/d640.htm Roll • Deal] | nowrap | . [http://jsoftware.com/books/help/dictionary/d640.htm Roll • Deal (fixed seed)] |- | nowrap |   |- | nowrap | a. [http://jsoftware.com/books/help/dictionary/dadot.htm Alphabet] | nowrap | a: [http://jsoftware.com/books/help/dictionary/dadot.htm Ace (Boxed Empty)] | nowrap | A. [http://jsoftware.com/books/help/dictionary/dacapdot.htm Anagram Index • Anagram] |- | nowrap | b. [http://jsoftware.com/books/help/dictionary/dbdotn.htm Boolean /] [http://jsoftware.com/books/help/dictionary/dbdotu.htm Basic] | nowrap | c. [http://jsoftware.com/books/help/dictionary/dcdot.htm Characteristic Values] | nowrap | C. [http://jsoftware.com/books/help/dictionary/dccapdot.htm Cycle-Direct • Permute] |- | nowrap | d. [http://jsoftware.com/books/help/dictionary/dddot.htm Derivative] | nowrap | D. [http://jsoftware.com/books/help/dictionary/ddcapdot.htm Derivative] | nowrap | D: [http://jsoftware.com/books/help/dictionary/ddcapco.htm Secant Slope] |- | nowrap | e. [http://jsoftware.com/books/help/dictionary/dedot.htm Raze In • Member (In)] | nowrap | E. [http://jsoftware.com/books/help/dictionary/decapdot.htm • Member of Interval] | nowrap | f. [http://jsoftware.com/books/help/dictionary/dfdot.htm Fix] |- | nowrap |   |- | nowrap | H. [http://jsoftware.com/books/help/dictionary/dhcapdot.htm Hypergeometric] | nowrap | i. [http://jsoftware.com/books/help/dictionary/didot.htm Integers • Index Of] | nowrap | i: [http://jsoftware.com/books/help/dictionary/dico.htm Integers • Index Of Last] |- | nowrap | j. [http://jsoftware.com/books/help/dictionary/djdot.htm Imaginary • Complex] | nowrap | L. [http://jsoftware.com/books/help/dictionary/dlcapdot.htm Level Of] | nowrap | L: [http://jsoftware.com/books/help/dictionary/dlcapco.htm Level At] |- | nowrap | m. n. [http://jsoftware.com/books/help/dictionary/dmdot.htm Explicit Noun Args] | nowrap | NB. [http://jsoftware.com/books/help/dictionary/dnb.htm Comment] | nowrap | o. [http://jsoftware.com/books/help/dictionary/dodot.htm Pi Times • Circle Function] |- | nowrap | p. [http://jsoftware.com/books/help/dictionary/dpdot.htm Polynomial] | nowrap | p.. [http://jsoftware.com/books/help/dictionary/dpdotdot.htm Poly. Deriv. • Poly. Integral] | nowrap | p: [http://jsoftware.com/books/help/dictionary/dpco.htm Primes •] |- | nowrap |   |- | nowrap | q: [http://jsoftware.com/books/help/dictionary/dqco.htm Prime Factors • Prime Exponents] | nowrap | r. [http://jsoftware.com/books/help/dictionary/drdot.htm Angle • Polar] | nowrap | s: [http://jsoftware.com/books/help/dictionary/dsco.htm Symbol] |- | nowrap | S: [http://jsoftware.com/books/help/dictionary/dscapco.htm Spread] | nowrap | t. [http://jsoftware.com/books/help/dictionary/dtdotu.htm Taylor Coefficient] | nowrap | t: [http://jsoftware.com/books/help/dictionary/dtco.htm Weighted Taylor] |- | nowrap | T. [http://jsoftware.com/books/help/dictionary/dtcapdot.htm Taylor Approximation] | nowrap | u. v. [http://jsoftware.com/books/help/dictionary/dudot.htm Explicit Verb Args] | nowrap | u: [http://jsoftware.com/books/help/dictionary/duco.htm Unicode] |- | nowrap | x. y. [http://jsoftware.com/books/help/dictionary/dxdot.htm Explicit Arguments] | nowrap | x: [http://jsoftware.com/books/help/dictionary/dxco.htm Extended Precision] | nowrap | _9: to 9: [http://jsoftware.com/books/help/dictionary/dconsf.htm Constant Functions] |}

=See also=

  • Function-level programming
  • Related programming languages:  APL programming language, FP programming language, FL programming language, K programming language
  • =External links=

    *[http://www.jsoftware.com JSoftware]- Creators of J (currently free for all uses) *[http://ww2.lafayette.edu/~reiterc Cliff Reiter]- Chaos, fractals and mathematical symmetries... in J *[http://www.ewartshaw.co.uk/ Ewart Shaw]- Bayesian inference, medical statistics, and numerical methods, using J *[http://www.cs.ualberta.ca/~smillie Keith Smillie]- Statistical applications of array programming languages, especially J *[http://www.cs.trinity.edu/~jhowland John Howland]- Research on parallelization of array programming languages, especially J *[http://peach.ease.lsoft.com/archives/jforum.html J Forum Archives]- Discussion of the language