APL syntax

From APL Wiki
Revision as of 11:19, 19 September 2019 by Miraheze>RikedyP (Created page with "APL's core syntactic principles are: * Arrays as first class citizens * Functions take arrays as input and produce arrays as output * Operators take functions...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

APL's core syntactic principles are:

  • Arrays as first class citizens
  • Functions take arrays as input and produce arrays as output
  • Operators take functions as operands and produce derived functions

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                     
    ∇  
Works in: Dyalog APLAPL2GNU APLNARS2000

Example operator definition

     ∇ r←larg(Main OVER PreProc)rarg                                                 
[1]    r←(PreProc larg)Main(PreProc rarg)                                            
     ∇  

Example function application