Skip to main content

BasedPL

BasedPL, the Based-array Programming Language, is an array language derived from APL, with ideas from J and BQN. Its notation aims to be simple and consistent. Most of this documentation calls it BPL. BPL is written in Rust and comes as a native executable, a Jupyter kernel and a Python API.

LLMs: read llms.txt first. It is the primary reference index and concise overview. In a BPL session, ]help llms shows the same file.

Install and try it

pip install basedpl
bpl

Each release also has a standalone bpl that needs no Python, for macOS on Apple silicon and for Linux on x86-64 and arm64. On a Mac:

curl -Lo bpl https://github.com/AnswerDotAI/basedpl/releases/latest/download/bpl-macos-arm64
chmod +x bpl

On Linux, download bpl-linux-x86_64 or bpl-linux-arm64 instead.

At the prompt, define a mean and apply it:

avg←+/÷≢
avg 2 4 9
5

Use bpl -e 'avg←+/÷≢ ⋄ avg 2 4 9' for a shell command. The command-line guide covers source files and pipes.

Interactive use

In the REPL, type a backtick followed by a glyph name. For example, `iota becomes ⍳ when you press Tab or type a non-letter. Abbreviations and Alt-key shortcuts are available. ]help + shows help for +. •prefs changes display settings, such as boxes and how much of a large array shows. See REPL and the glyph reference, which lists each glyph’s key.

In Jupyter, select the installed BasedPL kernel. Cells share definitions and support completion, Shift-Tab help and interruption. You can also use %%bpl cells in a Python notebook. See Using BPL notebooks.

New to APL?

APL is a language built around operations on whole arrays and notation for combining functions. Here is a taste of that style in BPL.

Numbers separated by spaces form a vector. Arithmetic applies to every item:

10+1 2 3
11 12 13

Operators modify or combine functions. Reduce (/) turns addition into summation. ⍳10 generates 0…9:

+/⍳10
45

Functions can also be combined without naming their arguments. In avg←+/÷≢, sum (+/) divided by tally (≢) defines the mean:

avg 1 2 3 4
2.5

To see how these ideas express an algorithm, start from “a prime has exactly two positive divisors”. Form all remainders of 1 to 50 (|⊗⍨↦50), count the zeros down each column (+⌿0=), and find the positions (⍸) whose count is two. Positions count from 0. ≥ increments each position to recover its number:

≥⍸2=+⌿0=|⊗⍨↦50
[2 3 5 7 11 13 17 19 23 29 31 37 41 43 47]ₓ

Getting started builds a primes function from the same divisor count, step by step, and displays the divisibility matrix along the way.

What’s distinctive?

For APL users, some key differences are:

  • Based arrays, as in BQN: numbers, characters and functions are atoms; enclosure always adds a layer.
  • Vectors in brackets, and grouping by spaces. [a b c] is a vector, and a+b × c+d is (a+b)×(c+d). A run that ends in a function is a train. For example, +/÷≢ x is the mean of x, and 2× doubles its argument. 0⌷v and v₀ both select the first item of v.
  • Leading-axis broadcasting, including expansion of length-1 axes, plus string keys and names on axes.
  • Exact integers and rationals alongside approximate real and complex numbers.
  • Dfns, trains and operators, with additions such as Under, iteration histories, windows and function arrays.

Positions and axes count from 0, as in BQN and Python. Approximate comparisons use tolerance 1E¯14. See the language principles for why BPL works this way, the glyph reference for Dyalog differences and Arrays for the array model.

Numbers

Bare numbers are approximate. Use ₓ for exact integers and r for exact fractions:

1r3+1r6
1ᵣ2

Complex numbers use j between real and imaginary parts. Functions such as square root extend into the complex domain:

√¯4
0ⱼ2

See Numbers for conversion and mixed arithmetic.

Array literals and broadcasting

Write matrix rows directly in an array literal. Leading-axis agreement lets a vector supply one offset per row:

m←[1 2 3
   4 5 6]
m+10 20
11 12 13
24 25 26

See array notation and broadcasting.

Keys and named axes

Axes can have names, and positions along them can have string keys. Describe the axes once, then select by key or reduce by axis name:

axes←["city":"NY" "LA";"month":"Jan" "Feb" "Mar"]
sales←axes:[10 20 30⋄40 50 60]
"LA" "Feb"⌷sales
+/⍠"month" sales
50

["city":2]⍴["NY":60 "LA":150]

Keys and names travel with axes through operations such as transpose. Arithmetic aligns matching names and keys. See Axis keys.

Function operators

A vector of counts keeps the history: one state for each count, where count 0 is the initial value. Here, double up to four times:

2×⍣(⍳5) 1
1 2 4 8 16

Under (@) transforms the argument, applies a function, then reverses the transformation. Scale by ten, floor, and scale back to round down to tenths:

⌊@ 10× 1.25 2.78
1.2 2.7

Explore iteration and inverses, Under, windows and function selection.

Mathematical tools

Primes and factorisation are built in:

⨸360ₓ
[2 2 2 3 3 5]ₓ

Polynomials support coefficients, roots and evaluation. Polynomial functions can be differentiated: for f(x) = 1 + 2x + 3x², f′(2) = 14.

f←[1 2 3]ₓ⌻ ⋄ f∂2ₓ
14ₓ

Probability distributions provide sampling, density, CDF and quantiles. Two fair coin tosses give these probabilities for 0, 1 and 2 heads:

coin←2 0.5 •distribution "binomial"
coin.density 0 1 2
0.25 0.5 0.25

Matrix division handles linear systems and least squares.

Data and text

JSON objects become keyed arrays, with dot access to their fields:

order←•json "{""price"":10.5,""qty"":2}"
order.price×order.qty
21

CSV headers likewise name column vectors. Files, CSV and JSON covers reading, transforming and writing data. Regex supplies matching, captures and replacement through Rust’s regex engine.

Drawing

•plot draws charts from arrays. Keys label the axes and name the lines. See Plots.

["legend":"end"]•plot sales

Build SVG from element functions and keyed attributes. Notebooks display the picture directly. The same element trees serialize to XML. See XML and SVG.

[circle text]←•element "circle" "text"
c←["cx":50 "cy":40 "r":25 "fill":"orange"]circle ""
t←["x":50 "y":85 "text-anchor":"middle"]text "Hello, SVG"
["width":240 "height":240]•svg c t

Python

BPL functions are Python callables:

from basedpl import fn

mean = fn('+/÷≢')
mean([1, 2, 3])

Arrays have .py, .np and .df conversions for Python values, NumPy and pandas. Functions also have Python names and composition operators. See the Python tutorial.

For other frontends, the process interfaces provide JSON messages and interruptible workers. The BPL library contains more algorithms, codecs, interpreters and puzzles.

Metadata

Release files for basedpl 0.1.36

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for basedpl 0.1.36
File Size Uploaded
basedpl-0.1.36.tar.gz 2.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for basedpl 0.1.36
File
basedpl-0.1.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
basedpl-0.1.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ ARM64 Details
basedpl-0.1.36-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
basedpl-0.1.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
basedpl-0.1.36-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ ARM64 Details
basedpl-0.1.36-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
basedpl-0.1.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
basedpl-0.1.36-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ ARM64 Details
basedpl-0.1.36-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
basedpl-0.1.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
basedpl-0.1.36-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ ARM64 Details
basedpl-0.1.36-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 133.7 MB

Release files / basedpl-0.1.36.tar.gz

Download URL basedpl-0.1.36.tar.gz
Size 2.2 MB
Tags Source
SHA-256 checksum
How to use checksums
856b55d58b2f9583e9564cae39383e8fe81b5de3ac21d9065f7af37ac0e3848f
BLAKE2b-256 checksum
How to use checksums
2b4395113abadffb6146bf107d09a33c811b927c0800eba7b458c42a9b70c2e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL basedpl-0.1.36-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.3 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
8446a4a9f627099928137a0b61bc46e85b4d0b36d76cd6e0f8746d5e60db3c71
BLAKE2b-256 checksum
How to use checksums
f0c925fb1fa1271c73f4e30ddbc9dd5cab67ea23a8754593a6338de8784e31d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL basedpl-0.1.36-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 10.5 MB
Tags CPython 3.13 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
4cb7ddbef316a93a0dc3da47fc9476cc314d283f755de3d45bbde5df4f04b94f
BLAKE2b-256 checksum
How to use checksums
bfa98bfdca31fe4551cd17ea31911997e61c70f7cd6b42d8de0642115b8cbfa5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp313-cp313-macosx_11_0_arm64.whl

Download URL basedpl-0.1.36-cp313-cp313-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2d8fb090190f1d9db1e1da0f1e62ab32ddafde4bf9c6ef43a460135ebc3b40ba
BLAKE2b-256 checksum
How to use checksums
3ae1a2bcda416b2d9d904d4fc4f054bec3143013e4b1dab79e34b60b1796fba3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL basedpl-0.1.36-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.3 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
92f18bb327ed428f7afe593f7d39f421fe60321512c0837ae2cc8cb6ca453ade
BLAKE2b-256 checksum
How to use checksums
fc8904eafe0ba4738d2d9f1a6969fafdf377b32d7f0d875f29e4ff61d88f77bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL basedpl-0.1.36-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 10.5 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
41f6814592893c6b684ddb84ff157905c91a77bf17276130c239d7ccbab2ae45
BLAKE2b-256 checksum
How to use checksums
47edebc2743e2f02f3ba755a453c8d84d1700458c8bc03061519df827f46f151
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp312-cp312-macosx_11_0_arm64.whl

Download URL basedpl-0.1.36-cp312-cp312-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
542ea8c951df62d7b2e8c5fa2c9d059e01dd5c9e4b1bbd5aba9f961d75283f40
BLAKE2b-256 checksum
How to use checksums
30e23a8ac589162fe3f51fc42c24d007353f8f7ab70ee9bec36633acfa768da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL basedpl-0.1.36-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cc6beab5c1ec0f45f7ca0989db88b3db4023e78d016398fd4717da42a4e1ce81
BLAKE2b-256 checksum
How to use checksums
27df40dbd656344b8b44c8c9965823de7786f806887856b9fd685cb699c4e4be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL basedpl-0.1.36-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 10.5 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
d2f826b49e7a74478dba4a644e6b7f764fe0ace48a49694751abc71f137b93e6
BLAKE2b-256 checksum
How to use checksums
41197922fb0c699e58fb5547cf8e96a21fb4633f61baed23bbd8651a13c07ae4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp311-cp311-macosx_11_0_arm64.whl

Download URL basedpl-0.1.36-cp311-cp311-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
042ca8e02c0ebb0ac3698777e6058b835df5ed918372cb360378e6af5653855a
BLAKE2b-256 checksum
How to use checksums
7a34cf7aaf1b8af001e7bd190ea18384d1ccd5d1d91919a9f90f78793666160d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL basedpl-0.1.36-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 12.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b8c34bb56b5ab93b06af6e9cc42291efc5769273a276a18bd91736fcf4d9afe4
BLAKE2b-256 checksum
How to use checksums
e928e564ec0ae8ebb13e9d1bdff475d25ac0404b9fe88b7e827310c4c8c422ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL basedpl-0.1.36-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 10.5 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
c92a2ee91b3175c95ddd4558287445edc7d3455124f017dd56be494f67c34212
BLAKE2b-256 checksum
How to use checksums
e48f8034e1a0c143273275182174e1d4ad9f7e93a80e913d34e515766d807013
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / basedpl-0.1.36-cp310-cp310-macosx_11_0_arm64.whl

Download URL basedpl-0.1.36-cp310-cp310-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
27ab3cc976f6de0eed6ff2ff49fe062d77b04886b355539be1ca7103b421f3b1
BLAKE2b-256 checksum
How to use checksums
e1cd941b567620d60c3aa1c8a83fabe6887943ed73aa92f4c4fc2b1286ca1668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page