APL syntax
Jump to navigation
Jump to search
APL's core syntactic principles are:
- Arrays as first class citizens
- Functions take arrays as argument(s) and produce arrays as result
- Functions have long right scope
- Operators take functions and/or arrays as operand(s) and produce derived functions
- Operators have long left scope
Contents
Example array definitions
simplenumvec←1 2 3 4 ⍝ A simple numeric vector
simplecharvec←'ABCD' ⍝ A simple character vector
Example function definition
∇ r←l Tradfn r
[1] ⍝ An infix (dyadic) tradfn
[2] r←l r
∇
Example operator definition
∇ r←larg(Main OVER PreProc)rarg
[1] r←(PreProc larg)Main(PreProc rarg)
∇
Example function application
÷3 ⍝ Prefix primitive function
0.3333333333
1+2 ⍝ Infix primitive function
3
+/1 2 3 4 ⍝ Prefix primitive derived function
10
2+/1 2 3 4 ⍝ Infix primitive derived function
3 5 7
Scoping rules
Functions
Operators
APL dialects [edit] | |
---|---|
Maintained | APL+Win (APL*PLUS) ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Co-dfns ∙ Dyalog APL ∙ dzaima/APL ∙ GNU APL ∙ NARS2000 ∙ ngn/apl |
Historical | Iverson notation ∙ A Programming Language ∙ A+ (A) ∙ APL# ∙ APL.68000 ∙ APL.SV ∙ APLX ∙ APL\1130 ∙ APL\360 ∙ NARS ∙ openAPL ∙ Rowan ∙ SHARP APL (SAX) ∙ VisualAPL (APLNext) ∙ VSAPL ∙ York APL |
Derivatives | ELI ∙ J ∙ K (Q, KDB+) ∙ LYaPAS ∙ Nial ∙ RAD |