Examples

APL's terseness means that substantial programs are expressible in a small space, relative to many other programming languages. Below are just a taste. Many more, and fully explained, examples are in the simple examples article.

Split text by delimiter

With the introduction of tacit programming, many functions can be expressed in fewer characters than even the shortest fitting name. For example ≠⊆⊢ is but three characters, while you would need five for the name Split :

Try it now!

',' ( ≠ ⊆ ⊢ ) 'comma,delimited,text' ┌─────┬─────────┬────┐ │ comma │ delimited │ text │ └─────┴─────────┴────┘

Full explanation…

Conway's "Game of Life"

John Scholes is famous for the following implementation of Conway's Game of Life:

Try it now!

⎕ ← world ← 2 2 2 2 ⊤ 0 12 5 2 4 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 { ↑ 1 ⍵ ∨ . ∧ 3 4 =+ / , ¯1 0 1 ∘. ⊖ ¯1 0 1 ∘. ⌽⊂ ⍵ } world 1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 1 1 0 0 0 1 0 0 0

Full article…

Further simple examples ∙ Advanced examples