J (programming language)

From Bauman National Library
This page was last modified on 1 June 2016, at 17:14.
J
J (programming language) icon.png
Paradigm Array, functional, function-level, tacit
Designed by Kenneth E. Iverson, Roger Hui
Developer JSoftware
First appeared 1990
Stable release J804 / 4.012016
Typing discipline dynamic
License GPLv3
Filename extensions .ijs
Website jsoftware.com
Influenced by
APL, FP, FL
Influenced
K, NumPy

J - vector functional programming language. It is dialect APL. Unlike APL does not require a special keyboard to enter mathematical symbols, because it uses ASCII characters. The programming language J was developed in the early 1990s by Kenneth Iverson and Roger Hui (Roger Hui) (Eng.), As a synthesis of the APL (also developed by Iverson) and combinatorial programming languages FP and the FL , developed by Backus. Its main features - a focus on the MIMD instruction, the functional approach.

Data types

J supports three simple types:

  • Numeric
  • Literal (Character)
  • Boxed

Vocabulary

Constantes
Controles
Foreigns
Partes de un programa
= 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
~ Reflex • Passive / EVOKE ~. Nub • ~: Nub Sieve • Not-Equal
| Magnitude • Residue |. Reverse • Rotate (Shift) |: Transpose
 
. Determinant • Dot 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
/ Insert • Table /. Oblique • Key /: Grade Up • Sort
\ Prefix • Infix \. Suffix • Outfix \: 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
m. n. Explicit Noun Args 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. v. Explicit Verb Args u: Unicode
x. y. Explicit Arguments x: Extended Precision _9: to 9: Constant Functions

Examples

An example of "Hello, world!" Program

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

Some examples of use 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

The implementation of quicksort:

  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.
   )

Control structures

J provides control structures, similar to other procedural languages. For example:

*assert.
*break.
*continue.
*for.
*goto_label.
*if. else. elseif.
*return.
*select. case.
*throw.
*try. catch.
*while. whilst.

External links

  1. Description
  2. Official website
  3. help
  4. Ewart Shaw