Difference between revisions of "Language Features"
Line 137:  Line 137:  
* [[Hypercomplex NumbersOctonion Numbers]]: <apll>1<_i/>2<_j/>3<_k/>4<_l/>5<_ij/>6<_jk/>7<_kl/>8</apll>  * [[Hypercomplex NumbersOctonion Numbers]]: <apll>1<_i/>2<_j/>3<_k/>4<_l/>5<_ij/>6<_jk/>7<_kl/>8</apll>  
* [[Ball Arithmetic]]: <apll>2.3<_pom/></apll> is a shorthand for a Ball whose Midpoint and Radius are <apll>2.3</apll> and <apll>2*¯53</apll>, respectively, because the Midpoint (<apll>2.3</apll>) cannot be represented exactly in doubleprecision floating point format with the standard <apll>53</apll> bits of precision.  * [[Ball Arithmetic]]: <apll>2.3<_pom/></apll> is a shorthand for a Ball whose Midpoint and Radius are <apll>2.3</apll> and <apll>2*¯53</apll>, respectively, because the Midpoint (<apll>2.3</apll>) cannot be represented exactly in doubleprecision floating point format with the standard <apll>53</apll> bits of precision.  
−  
==Java Support==  ==Java Support== 
Revision as of 05:43, 2 February 2020
At the moment, the following sections describe only those language features that are New or Enhanced relative to the Extended APL Standard, or that deserve special comment.
Contents
Syntax
 Strand Assignment: (A1 A2 ... An)←R
 Modified Assignment: Af←R
 Modify Strand Assignment: (A1 A2 ... An)f←R
 Hyperators: ∇ Z←L (LO (LH dhdo RH) RO) R
 Function/Operator/Hyperator Assignment: A←f, A←op1, A←op2
 Binding Strength: How Variables, Functions, Operators, Hyperators and other syntactic elements combine
 Sink: ←R
 Point Notation:
 Base — 16b10FFFF is a shorthand for 16⊥1 0 15 15 15 15 and 10b45v is a shorthand for 10⊥4 5 31.
 Euler — 2x3 is a shorthand for 2∙e^{3} or 2×(*1)*3 where e is Euler's Number (2.718281828459045...).
 Pi — 2p3 is a shorthand for 2∙π^{3} or 2×(○1)*3 where π is Archimedes' constant (3.141592653589793...).
 Gamma — 2g3 is a shorthand for 2∙γ^{3} where γ is EulerMascheroni's Constant (0.5772156649015329...).
 Zeta — 2z3 is a shorthand for 2∙ζ(3) where ζ(x) is the Riemann Zeta function.
 Hypercomplex — 2i3, 2J3 (both equal to 2+3×√¯1), 2ad3 (Angle in Degrees), 2ar3 (Angle in Radians), 2au3 (Angle in Unit Normalized), or 2ah3 (Angle in Half Unit Normalized) for a Complex number, 1i2j3k4 for a Quaternion number, and 1i2j3k4l5ij6jk7kl8 for an Octonion number.
 Rational — 2r3 is a shorthand for 2÷3 as a MultiplePrecision Integer/Rational number.
 VariablePrecision Floating — 2.3v is a shorthand for 2.3 as a MultiplePrecision Floating Point number.
 Ball Arithmetic — 2.3±1E¯17 is a shorthand for a Ball whose Midpoint and Radius are 2.3 and 1E¯17, respectively.
 Trains: e.g., avg←(+⌿ ÷ ≢) applies the functions to its argument(s) in a particular way (in this case, to compute the average of a numeric scalar or vector).
 Anonymous Functions/Operators/Hyperators: multiline grouping of one or more statements all enclosed in braces such as {(+⌿⍵)÷≢⍵}.
Primitive Functions
Name  Symbol/Syntax  Function Valence 
Array Lookup  L⍸R  dyadic 
Condense  <[X] R  monadic 
Dilate  >[X] R  monadic 
Expand  L\[X] R  dyadic 
Find  L⍷R  dyadic 
Index Generator  ⍳R  monadic 
Index Of  L⍳R  dyadic 
Indexing  R[L], R[L]←A, R[L]f←A, L⌷[X] R, L⍉R, L⊃R  dyadic 
Indices  ⍸R  monadic 
Matrix Inverse/Divide  ⌹R, L⌹R  ambivalent 
Mismatch  L≢R  dyadic 
Partitioned Enclose  L⊂[X] R  dyadic 
Primes  πR, LπR  ambivalent 
Reshape  L⍴R  dyadic 
Root  √R, L√[X] R  ambivalent 
Sequence  L..R  dyadic 
Sets  L§R, L⊆R, L⊇R  dyadic 
Tally  ≢R  monadic 
Without  L~R  dyadic 
where L is the Left argument, R is the Right argument, and [X] is an optional Axis value.
Primitive Operators
Name  Symbol/Syntax  Derived Function Valence 
Axis  {L} f[X] R, {L} f op1[X] R, {L} f op2[X] g R  ambivalent 
Combinatorial  a‼ R  monadic 
Commute  L f⍨ R ←→ R f L  dyadic 
Compose  {L} f∘g R, f∘b R, a∘g R  ambivalent/monadic 
Composition  {L} f⍥g R  ambivalent 
Convolution  L f⍡g R  dyadic 
Determinant  f.g R  monadic 
Duplicate  f⍨ R ←→ R f R  monadic 
Integral  {L} f∫ R  ambivalent 
Inverses  {L} f⍣¯1 R  ambivalent 
Mask  L (a∘/) R, L (a∘⌿) R, L (a∘/[X]) R  dyadic 
Matrix  {L} f⌻ R, ∘⌻ R  ambivalent/monadic 
Mesh  L (a∘\) R, L (a∘⍀) R, L (a∘\[X]) R  dyadic 
Multisets  {L} f⍦ R  ambivalent 
Nth Derivative  {L} f∂ R, {L} f∂∂ R, etc.  ambivalent 
Null  {L} f⊙ R  ambivalent 
Power  {L} f⍣g R, {L} f⍣b R  ambivalent 
Rank  {L} f⍤[X] b R  ambivalent 
Variant  {L} f⍠b R  ambivalent 
where {L} is an optional Left argument, R is the Right argument, f and g represent Functions, a and b represent Variables, and [X] is an optional Axis value.
Primitive Hyperators
Name  Symbol/Syntax  Derived Function Valence 
Transform  f h⍑g R  monadic 
where {L} is an optional Left argument, R is the Right argument, f and g represent Functions, h represents a Function/Operator, and [X] is an optional Axis value.
Also, see Hyperators.
Datatypes
 Infinity: ∞ and ¯∞
 Arithmetic Progression Arrays: 2 3 4⍴⍳24
 Unicode Characters
 Array Predicates
 Rational Numbers: 1r3 and 12345x
 Variableprecision Floating Point (VFP) Numbers: 1.234v and 12v
 Complex Numbers: 1i2 or 3.4i5 or 2ad90 or 22ar.1 or 20au.5
 Quaternion Numbers: 1i2j3k4
 Octonion Numbers: 1i2j3k4l5ij6jk7kl8
 Ball Arithmetic: 2.3± is a shorthand for a Ball whose Midpoint and Radius are 2.3 and 2*¯53, respectively, because the Midpoint (2.3) cannot be represented exactly in doubleprecision floating point format with the standard 53 bits of precision.
Java Support
The Java programming language is now supported. You can now write code in Java, and call it from APL. For more details, see Java Support.
System Commands
System Commands provide features to the user of the APL system, separate from actual workspaces, variables or APL operators. These provide such features as accessing files, saving a workspace, and exiting the APL interpreter. The commands are not case sensitive, so )IN and )in do the same thing.
NARS2000 currently has the following system commands:


System Variables and Functions
System Variables (A value may be assigned to these except for ⎕DM)  

⎕ALX  ⎕CT  ⎕DM  ⎕DT  ⎕ELX  ⎕FC  ⎕FEATURE  ⎕FPC  ⎕IC  ⎕IO 
⎕LR  ⎕LX  ⎕PP  ⎕PR  ⎕PW  ⎕RL  ⎕SA  ⎕WSID  
Niladic System Functions (a value cannot be assigned to these)  
⎕A  ⎕AV  ⎕EM  ⎕ET  ⎕LC  ⎕NNAMES  ⎕NNUMS  ⎕SI  ⎕SYSID  ⎕SYSVER 
⎕T  ⎕TC  ⎕TCBEL  ⎕TCBS  ⎕TCESC  ⎕TCFF  ⎕TCHT  ⎕TCLF  ⎕TCNL  ⎕TCNUL 
⎕TS  ⎕WA  
Monadic or dyadic system functions (a value cannot be assigned to these)  
⎕AT  ⎕CR  ⎕DC  ⎕DFT  ⎕DL  ⎕DR  ⎕EA  ⎕EC  ⎕ERROR  ⎕ES 
⎕EX  ⎕FMT  ⎕FX  ⎕MF  ⎕NAPPEND  ⎕NC  ⎕NCREATE  ⎕NERASE  ⎕NINFO  ⎕NL 
⎕NLOCK  ⎕NREAD  ⎕NRENAME  ⎕NREPLACE  ⎕NRESIZE  ⎕NSIZE  ⎕NTIE  ⎕NUNTIE  ⎕STOP  ⎕TF 
⎕TRACE  ⎕UCS  ⎕VR  
Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive 