Mini APL in Python Language Experiment. Uses numpy arrays.
Project description
MARPLE
MARPLE is an experimental APL interpreter that runs on Linux. It already has enough features to be usable, though may more are planned.
I've removed the Pico version for now; it was greatly complicating the codebase. Much of the code has now been refactored.
MARPLE was inspired by Rodrigo Girão Serrão's RGSPL and Iverson's Dictionary of APL. It has taken many additional features from Dyalog APL(TM).
Marple is written in Python and uses numpy for array operations.
While MARPLE has extensive automated tests, it is not and will never be a commercial strength APL. If that's what you want, get Dyalog APL. Dyalog APL is free for non-commercial work
See the full feature list, architecture, and documentation.
Platform support
MARPLE is developed and tested on Linux. It should also run on Windows or Mac, but I do not have the resources to test it in those environments.
Quick start
Install uv if you don't have it, then:
git clone https://github.com/romilly/marple.git
cd marple
uv venv
source venv/bin/activate
uv pip install -r requirements.txt
marple
MARPLE v0.6.17 - Mini APL in Python
CLEAR WS
⍳5
1 2 3 4 5
+/⍳100
5050
fact←{⍺←1 ⋄ ⍵=0:⍺ ⋄ (⍺×⍵)∇ ⍵-1}
fact 20
2432902008176640000
PRIDE Web IDE
From within the virtual environment:
marple-server # default: http://0.0.0.0:8888/ (LAN-accessible)
marple-server --port 9000
marple-server --host 127.0.0.1 # localhost only
The startup banner prints both a localhost: URL and a LAN URL using
the machine's hostname. Open either in a browser.
PRIDE features
- a clickable language bar for APL glyph input
- workspace panel,
- session with system commands,
- session save/load, and
- interactive ⎕/⍞ input.
Running PRIDE on one machine, browsing from another
MARPLE's web server binds to all network interfaces by default, so you can run the interpreter on a Raspberry Pi (or any other machine on your home network) and connect from your desktop browser:
# On the Pi:
marple-server
# On your workstation, in a browser:
http://pi.local:8888/
# …or whatever the Pi's hostname or IP is
This is the simplest way to develop MARPLE on a Pi from a workstation, and it lets you use MARPLE from Windows or Mac machines that don't have the Python environment installed locally.
Security note: the server has no authentication. Only run it on networks where you trust every device — a home LAN is fine, a coffee-shop WiFi is not. For anything beyond a trusted LAN, put PRIDE behind an authenticating reverse proxy (Caddy, nginx + basic auth, Tailscale, etc.).
Jupyter Notebook
uv pip install marple-lang[jupyter]
marple-jupyter-install
jupyter notebook
Select MARPLE (APL) as the kernel.
Running scripts
marple examples/01_primitives.marple
For a demo of Bob Smith's partition functions, )load part_fns. See also Conway's Game of Life example.
APL character input
Dyalog keyboard layout (recommended)
On Linux with an extended keyboard (with a Windows/Super key), run:
./scripts/aplkeys.sh
This configures the Dyalog APL keyboard layout using setxkbmap. Hold the Windows key (Super) to type APL glyphs; hold Shift+Windows for the extended set. Each key has up to four meanings:
┌────────┐
│~ ⌺ │ top-left: Shifted top-right: Shift+Win
│` ⋄ │ bottom-left: Unshifted bottom-right: Win
└────────┘
Full US layout (see Dyalog keyboard reference for other layouts):
┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬─────────┐
│~ ⌺ │! ⌶ │@ ⍫ │# ⍒ │$ ⍋ │% ⌽ │^ ⍉ │& ⊖ │* ⍟ │( ⍱ │) ⍲ │_ ! │+ ⌹ │Backspace│
│` ⋄ │1 ¨ │2 ¯ │3 < │4 ≤ │5 = │6 ≥ │7 > │8 ≠ │9 ∨ │0 ∧ │- × │= ÷ │ │
├────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬──────┤
│Tab │Q │W │E ⍷ │R │T ⍨ │Y │U │I ⍸ │O ⍥ │P ⍣ │{ ⍞ │} ⍬ │| ⊣ │
│ │q ? │w ⍵ │e ∊ │r ⍴ │t ~ │y ↑ │u ↓ │i ⍳ │o ○ │p * │[ ← │] → │\ ⊢ │
├───────┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴┬───┴──────┤
│Caps │A │S │D │F ⍛ │G │H │J ⍤ │K ⌸ │L ⌷ │: ≡ │" ≢ │Enter │
│Lock │a ⍺ │s ⌈ │d ⌊ │f _ │g ∇ │h ∆ │j ∘ │k ' │l ⎕ │; ⍎ │' ⍕ │ │
├────────┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──┬─┴──────────┤
│Shift │Z ⊆ │X │C │V │B │N │M │< ⍪ │> ⍙ │? ⍠ │Shift │
│ │z ⊂ │x ⊃ │c ∩ │v ∪ │b ⊥ │n ⊤ │m | │, ⍝ │. ⍀ │/ ⌿ │ │
├───────┬─────┬──────┬──────────────────────────┬──────┬──────┬─────┬──────┤
│Ctrl │Win │Alt │ Space bar │Alt Gr│Win │Menu │Ctrl │
└───────┴─────┴──────┴──────────────────────────┴──────┴──────┴─────┴──────┘
PRIDE language bar
In the PRIDE web IDE, you can click glyphs in the language bar at the top of the screen. No keyboard setup required.
System commands
| Command | Action |
|---|---|
)off |
Exit |
)clear |
Clear workspace |
)wsid [name] |
Show or set workspace ID |
)save [name] |
Save workspace |
)load name |
Load workspace |
)lib |
List saved workspaces |
)drop name |
Delete a saved workspace |
)fns [ns] |
List defined functions |
)ops [ns] |
List defined operators |
)vars |
List defined variables |
Development
uv pip install -r requirements-test.txt
pytest # fast tests (~1.2s)
pytest -m slow # PRIDE, WebSocket, deep TCO, ⎕DL tests
pyright src/
References
- RGSPL — Rodrigo Girão Serrão's Python APL interpreter (design reference)
- RGSPL blog series — step-by-step interpreter build
- Iverson's Dictionary of APL — the rank operator and leading-axis theory
- Language spec — full APL reference and roadmap
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file marple_lang-0.9.0.tar.gz.
File metadata
- Download URL: marple_lang-0.9.0.tar.gz
- Upload date:
- Size: 91.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceff8659733f59a9960278f4ddda0f56a09b9d352d5a450f7477bb9edb795020
|
|
| MD5 |
d7677783291ec8acca91495dce30d05f
|
|
| BLAKE2b-256 |
30620a6dd1b98b1f8002509dd47e8b20a480e85cfe9b0d3b40803cd8e02524b3
|
File details
Details for the file marple_lang-0.9.0-py2.py3-none-any.whl.
File metadata
- Download URL: marple_lang-0.9.0-py2.py3-none-any.whl
- Upload date:
- Size: 104.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1858b1a2d3ccc382a5a513e5dc65a4e15519e45fa97995b00a4f2add69336bbd
|
|
| MD5 |
52850f92cd46f4baa566f22c0ca48fd8
|
|
| BLAKE2b-256 |
3ea7eec00eee9d6610812db06460e909ed6e544e9ec21ecc30cf325e167c60c4
|