💾 Archived View for gem.sdf.org › s.kaplan › cheatsheets › programming-languages › apl.md captured on 2024-06-16 at 12:45:41.

View Raw

More Information

⬅️ Previous capture (2023-09-28)

-=-=-=-=-=-=-

# APL Cheatsheet

## Unique Features
- Array-oriented language
- Uses special characters for built-in functions and operators
- Supports complex numbers and other mathematical structures
- Strongly typed
- Interactive development environment
- High degree of conciseness

## Variables

⍺ ← 2 ⋄ ⍵ ← 3 ⋄ result ← ⍺ + ⍵


## Functions

function_name ← { ⍝ Function definition

⍝ Function body

}

function_name argument1 argument2 ⍝ Function call


## Loops

⍳10 ⍝ For loop

{⍝ While loop

⍝ Loop body

}⍣(condition)


## Conditionals

condition ⌷(true_code; false_code) ⍝ If-else statement

condition ⍴ true_code ⍝ If statement


## File Manipulation

⎕NGET 'file_name' ⍝ Reading from a file

⎕NPUT 'file_name' 'text to write' ⍝ Writing to a file


## Resources
- [APL Wiki](https://aplwiki.com/)
- [Dyalog APL](https://www.dyalog.com/)
- [APL Orchard](https://apl.chat/home) (community forum)
- [Mastering Dyalog APL](https://www.dyalog.com/mastering-dyalog-apl.htm) (book)