FACTOID # 179: Japan has more road than Canada.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > J (programming language)
J
Paradigm: array, functional, function-level, tacit
Appeared in: 1990
Designed by: Ken Iverson & Roger Hui
Developer: JSoftware
Typing discipline: strong
Major implementations: J
Influenced by: APL, FP, FL

The J programming language, developed in the early 1990s by Ken Iverson and Roger Hui, is a synthesis of APL (also by Iverson) and the FP and FL function-level languages created by John Backus. A programming paradigm is a paradigmatic style of programming (compare with a methodology, which is a paradigmatic style of doing software engineering). ... Array programming languages (also known as vector or multidimensional languages) generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays. ... Functional programming is a programming paradigm that conceives computation as the evaluation of mathematical functions and avoids state and mutable data. ... Function-level programming refers to one of the two contrasting programming paradigms identified by John Backus in his work on Programs as mathematical objects, the other being Value-level programming. ... The tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments. ... Year 1990 (MCMXC) was a common year starting on Monday (link displays the 1990 Gregorian calendar). ... Kenneth E. Iverson (17 December 1920, Camrose, Alberta/Canada –October 19, 2004,Toronto, Ontario/Canada) was a computer scientist most notable for developing the APL programming language. ... Roger Hui was co-developer of the J Programming Language. ... For other uses, see Software developer (disambiguation). ... In computer science, a type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. ... In computing, strongly-typed, when applied to a programming language, is used to describe how the language handles datatypes. ... Look up Implementation in Wiktionary, the free dictionary. ... APL (for A Programming Language) is an array programming language based on a notation invented in 1957 by Kenneth E. Iverson while at Harvard University. ... FP (short for Function Programming) is a programming language created by John Backus to support the Function-level programming paradigm. ... FL (short for Function Level) is a programming language created at the IBM Almaden Research Center by John Backus, John Williams, and Edward Wimmers in 1989. ... Kenneth E. Iverson (17 December 1920, Camrose, Alberta/Canada –October 19, 2004,Toronto, Ontario/Canada) was a computer scientist most notable for developing the APL programming language. ... Roger Hui was co-developer of the J Programming Language. ... APL (for A Programming Language) is an array programming language based on a notation invented in 1957 by Kenneth E. Iverson while at Harvard University. ... FP (short for Function Programming) is a programming language created by John Backus to support the Function-level programming paradigm. ... FL (short for Function Level) is a programming language created at the IBM Almaden Research Center by John Backus, John Williams, and Edward Wimmers in 1989. ... Function-level programming refers to one of the two contrasting programming paradigms identified by John Backus in his work on Programs as mathematical objects, the other being Value-level programming. ... John Backus (born December 3, 1924) is an American computer scientist, notable as the inventor of the first high-level programming language (FORTRAN), the Backus-Naur form (BNF, the almost universally used notation to define formal language syntax), and the concept of Function-level programming. ...


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 digraphs formed using the dot and colon characters to extend the meaning of the basic characters available. Image:ASCII fullsvg There are 95 printable ASCII characters, numbered 32 to 126. ... Digraphs are two-character sequences used to enter single characters that cannot be entered from the computer keyboard for various reasons: obsolete keyboard, input of special characters is required, the text editor reserves some characters for special use, etc. ...


Being an array programming language, J is very terse and powerful, and is most suited to mathematical and statistical programming, especially when performing operations on matrices. Array programming languages (also known as vector or multidimensional languages) generalize operations on scalars to apply transparently to vectors, matrices, and higher dimensional arrays. ... Mathematics is commonly defined as the study of patterns of structure, change, and space; more informally, one might say it is the study of figures and numbers. Mathematical knowledge is constantly growing, through research and application, but mathematics itself is not usually considered a natural science. ... For Wikipedia statistics, see m:Statistics Statistics is the science and practice of developing human knowledge through the use of empirical data expressed in quantitative form. ... In mathematics, a matrix (plural matrices) is a rectangular table of numbers or, more generally, a table consisting of abstract quantities that can be added and multiplied. ...


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). Function-level programming refers to one of the two contrasting programming paradigms identified by John Backus in his work on Programs as mathematical objects, the other being Value-level programming. ... The tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments. ...


Unlike most languages that support object-oriented programming, J's flexible hierarchical namespace scheme (where every name exists in a particular locale) can be effectively used as a framework for both class-based and prototype-based object oriented programming. Object-oriented programming (OOP) is a programming paradigm that uses objects to design applications and computer programs. ... A namespace is a context in which a group of one or more identifiers might exist. ... Class-based programming, or more commonly class-orientation, refers to the style of object-oriented programming in which inheritance is achieved by defining classes of objects, as opposed to the objects themselves (compare Prototype-based programming). ... Prototype-based programming is a style of object-oriented programming in which classes are not present, and behaviour reuse (known as inheritance in class-based languages) is performed via a process of cloning existing objects that serve as prototypes. ... Object-oriented programming (OOP) is a computer programming paradigm in which a software system is modeled as a set of objects that interact with each other. ...


J is a non-von Neumann programming language that nevertheless allows the programmer to use von Neumann programming style when desired. The term von Neumann language refers to those programming languages that are high-level abstract isomorphisms of von Neumann architectures. ...

Contents

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 A hello world program is a computer program that prints out Hello, World! on a display device. ...

 '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 interpreter 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 items in the array. +/ sums the items of the array. % divides the sum by the number of items. Note: avg is a train of verbs known as a fork. Specifically (V0 V1 V2) Ny is the same as (V0 Ny) V1 (V2 Ny) which shows some of the power of J. (Here V0, V1, V2 denote verbs and Ny denotes a noun.)


Some examples of using avg :

 v=: ?. 20 $ 100 NB. a random vector v 46 55 79 52 54 39 60 57 60 94 46 78 13 18 51 92 78 60 90 62 avg v 59.2 4 avg v NB. moving average on periods of size 4 58 60 56 51.25 52.5 54 67.75 64.25 69.5 57.75 38.75 40 43.5 59.75 70.25 80 72.5 m=: ?. 4 5 $ 50 NB. a random matrix m 46 5 29 2 4 39 10 7 10 44 46 28 13 18 1 42 28 10 40 12 avg"1 m NB. apply avg to each rank 1 subarray (each row) of m 17.2 22 21.2 26.4 

Here is an implementation of quicksort, from the J Dictionary: Quicksort in action on a list of random numbers. ...

 sel=: adverb def 'u # [' quicksort=: verb define if. 1 >: #y do. y else. (quicksort y <sel e),(y =sel e),quicksort y >sel e=.y{~?#y end. ) 

The following is an implementation of quicksort demonstrating tacit programming. Tacit programming involves composing functions together and not referring explicitly to any variables. J's support for forks and hooks dictates rules on how arguments applied to this function will be applied to its component functions. The tacit programming is a programming paradigm in which a function definition does not include information regarding its arguments. ...

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

The following expression exhibits pi with n digits and demonstrates the extended precision capabilities of J: When a circles diameter is 1, its circumference is π. Pi or π is the ratio of a circles circumference to its diameter in Euclidean geometry, approximately 3. ...

 n=: 50 NB. set n as the number of digits required <.@o. 10x^n NB. extended precision 10 to the nth * pi 314159265358979323846264338327950288419716939937510 

Also have a look at Cliff Reiter's implementation of Conway's game of life at http://ww2.lafayette.edu/~reiterc/j/vector/vlife_index.html Gospers Glider Gun creating gliders. The Game of Life is a cellular automaton devised by the British mathematician John Horton Conway in 1970. ...


Data Types and Structures

J supports three simple types:

  • Numeric
  • Literal (Character)
  • Boxed

Of these, numeric has the most variants.


One of J's numeric types is the bit. There are two bit values: 0, and 1. Additionally, bits can be formed into lists. For example, 1 0 1 0 1 1 0 0 is a list of eight bits. And, syntactically, the J parser treats that as a single word (space characters are recognized as a word forming character when they're between what would otherwise be numeric words). Lists of arbitrary length are supported.


Furthermore, J supports all the usual binary operations on these lists, such as and, or, exclusive or, rotate, shift, not, etc. For example,

 1 0 0 1 0 0 1 0 +. 0 1 0 1 1 0 1 0 NB. or 1 1 0 1 1 0 1 0 3 |. 1 0 1 1 0 0 1 1 1 1 1 NB. rotate 1 0 0 1 1 1 1 1 1 0 1 

Note that J also supports higher order arrays of bits -- they can be formed into two-dimensional, three-dimensional, etc. arrays. The above operations perform equally well on these arrays.


Other numeric types include integer (3, 42), floating point (3.14, 8.8e22), complex (0j1, 2.5j3e88), extended precision integer (12345678901234567890x), and (extended precision) rational fraction (1r2, 3r4). As with bits, these can be formed into lists or arbitrarily dimensioned arrays. As with bits, operations are performed on all numbers in an array.


Lists of bits can be converted to integer using the #. verb. Integers can be converted to lists of bits using the #: verb. (And, when parsing J, . and : are word forming characters. They're never tokens by themselves unless preceded by a space.)


J also supports the literal (character) type. Literals are enclosed in quotes, for example, 'a' or 'b'. Lists of literals are also supported using the usual convention of putting multiple characters in quotes, such as 'abcdefg'. Typically, individual literals are 8-bits wide (ascii), but J also supports other literals (unicode). Numeric and boolean operations are not supported on literals, but collection oriented operations (such as rotate) are supported.


Finally, there's the boxed data type. Typically, data is put in a box using the < operation (without any left argument -- if there's a left argument, this would be the 'less than' operation). This is analogous to C's & operation (without any left argument). However, where the result of C's & has reference semantics, the result of J's < has value semantics. In other words, < is a function and it produces a result. The result has 0 dimensions, regardless of the structure of the contained data. From the viewpoint of a J programmer, < 'puts the data into a box' and lets the programmer work with an array of boxes (it can be assembled with other boxes, and/or additional copies can be made of the box). Boxed data is displayed by J, somewhat after the fashion some SQL interpreters decorate table results from select statements. C is a general-purpose, block structured, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. ... SQL (IPA: or IPA: ), commonly expanded as Structured Query Language, is a computer language designed for the retrieval and management of data in relational database management systems, database schema creation and modification, and database object access control management. ...

 <1 0 0 1 0 +---------+ |1 0 0 1 0| +---------+ 

The only collection type offered by J is the arbitrarily dimensioned array. Most algorithms can be expressed very concisely using operations on these arrays.


J's arrays are homogenously typed, for example the list 1 2 3 is a list of integers despite the fact that 1 is a bit. For the most part, these sorts of type issues are transparent to the programmer. Only certain specialized operations reveal differences in type. For example, the list 1.0 0.0 1.0 0.0 would be treated exactly the same, by most operations, as the list 1 0 1 0.


J also supports sparse numeric arrays where non-zero values are stored with their indices. This is an efficient mechanism where relatively few values are non-zero.


J also supports objects and classes, but these are an artifact of the way things are named, and are not data types in and of themselves. Instead, boxed literals are used to refer to objects (and classes). J data has value semantics, but objects and classes need reference semantics.


Another pseudo-type -- associated with name, rather than value -- is the memory mapped file.


Dictionary

J's documentation is organized as a dictionary, with words in J identified as nouns, verbs, adverbs, conjunctions, and so on. Here's an overview (with external links into the corresponding definitions,). Parts of speech are indicated using markup: nouns, verbs, and adverbs, and conjunctions. Note that verbs have two forms -- monads (arguments only on the right) and dyads (arguments on the left and on the right). For example, in '-1' the hyphen is a monad, and in '3-2' the hyphen is a dyad. The monad definition is mostly independent of the dyad definition, regardless of whether the verb is a primitive verb or a derived verb.


Vocabulary

 Constants Controls Foreigns Parts of Speech 
= Self-Classify • Equal =. Is (Local) =: Is (Global)
< Box • Less Than <. Floor • Lesser Of (Min) <: Decrement • Less Or Equal
> Open • Larger Than >. Ceiling • Larger of (Max) >: Increment • Larger Or Equal
_ Negative Sign / Infinity _. Indeterminate _: Infinity
 
+ Conjugate • Plus +. Real / Imaginary • GCD (Or) +: Double • Not-Or
* Signum • Times *. Length/Angle • LCM (And) *: Square • Not-And
- Negate • Minus -. Not • Less -: Halve • Match
% Reciprocal • Divide %. Matrix Inverse • Matrix Divide %: Square Root • Root
 
^ Exponential • Power ^. Natural Log • Logarithm ^: Power
$ Shape Of • Shape $. Sparse $: Self-Reference
~ ReflexPassive / EVOKE ~. Nub • ~: Nub Sieve • Not-Equal
| Magnitude • Residue |. Reverse • Rotate (Shift) |: Transpose
 
. DeterminantDot Product .. Even .: Odd
: Explicit / Monad-Dyad :. Obverse :: Adverse
, Ravel • Append ,. Ravel Items • Stitch ,: Itemize • Laminate
; Raze • Link ;. Cut ;: Word Formation •
 
# Tally • Copy #. Base 2 • Base #: Antibase 2 • Antibase
! Factorial • Out Of !. Fit (Customize) !: Foreign
/ InsertTable /. ObliqueKey /: Grade Up • Sort
PrefixInfix . SuffixOutfix : Grade Down • Sort
 
[ Same • Left   [: Cap
] Same • Right    
{ Catalogue • From {. Head • Take {: Tail •   {:: Map • Fetch
} Item Amend • Amend }. Behead • Drop }: Curtail •
 
" Rank ". Do • Numbers ": Default Format • Format
` Tie (Gerund)   `: Evoke Gerund
@ Atop @. Agenda @: At
& Bond / Compose &. Under (Dual) &: Appose
&.: Under
? Roll • Deal ?. Roll • Deal (fixed seed)
 
a. Alphabet a: Ace (Boxed Empty) A. Anagram Index • Anagram
b. Boolean / Basic c. Characteristic Values C. Cycle-Direct • Permute
d. Derivative D. Derivative D: Secant Slope
e. Raze In • Member (In) E. • Member of Interval f. Fix
 
H. Hypergeometric i. Integers • Index Of i: Integers • Index Of Last
j. Imaginary • Complex L. Level Of L: Level At
NB. Comment o. Pi Times • Circle Function
p. Polynomial p.. Poly. Deriv. • Poly. Integral p: Primes
 
q: Prime Factors • Prime Exponents r. Angle • Polar s: Symbol
S: Spread t. Taylor Coefficient t: Weighted Taylor
T. Taylor Approximation u: Unicode
x: Extended Precision _9: to 9: Constant Functions

The word rank in the J programming language, has several different meanings. ...

See also

APL (for A Programming Language) is an array programming language based on a notation invented in 1957 by Kenneth E. Iverson while at Harvard University. ... K is a high level array programming language developed by Arthur Whitney, an influential APL programmer. ...

External links

  • JSoftware - Creators of J (currently free for all uses)
  • J Wiki - Showcase, documentation, articles, etc.
  • J Forum Archives - Discussion of the language
  • Cliff Reiter - Chaos, fractals and mathematical symmetries... in J
  • Ewart Shaw - Bayesian inference, medical statistics, and numerical methods, using J
  • Keith Smillie - Statistical applications of array programming languages, especially J
  • John Howland - Research on parallelization of array programming languages, especially J

  Results from FactBites:
 
J programming language - definition of J programming language in Encyclopedia (500 words)
The J programming language, developed in the early 90's by Ken Iverson and Roger Hui, is a synthesis of APL (also by Iverson) and the FP and FL functional programming languages created by John Backus (of FORTRAN, ALGOL, and BNF fame).
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 matrices.
J is an non-von Neumann programming language that nevertheless allows the programmer to use von Neumann programming style when desired.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.