Rank

Reinventing BASIC for modern handhelds

Small screens. Big algorithms.

Rank is a contemporary statically typed language with clear BASIC-inspired syntax adapted to APL's array approach.

Made for the joy of solving contest problems like Project Euler, Advent of Code and LeetCode, with your own head instead of a laptop or an LLM.

Intended for small screens and small keyboards, on devices with gigabytes of RAM and multicore CPUs, like any budget phone. Rank programs fit comfortably within 40 columns and use words and spaces instead of the brackets, commas and semicolons that are hard to reach on a phone's second keyboard. Operations apply to whole arrays, so you can program without writing explicit loops.

Click a line to edit. Enter evaluates.
Ctrl-R steps. Ctrl-L runs all. Ctrl-G selects an iteration.

Get it on Google Play or App Store.

Get it on Google Play Download on the App Store

The language

Rank is a readable array language — the power of APL's model with words instead of glyphs. Source is designed to stay around 40 characters per line, using words and familiar symbols rather than punctuation-heavy syntax.

Data flows through functions from left to right. A range can feed directly into a sum:

rank> use numbers
rank> 1 to 5 sum
15

One addressing model for arrays, tensors and tables. Arithmetic and boolean masks apply to whole collections without writing a loop:

rank> A = array 1 2 3
1 2 3
rank> A * 10 + 1
11 21 31

A notebook-style CLI with editable cells, inline results and step-by-step execution, available in your terminal, browser and on your phone.

Advanced capabilities

Tensor operations include broadcasting, reductions along axis, operations on cells with rank, matrix multiplication and linear-system solvers.

M = array 1 to 9 shape 3 3
Blocks = M window 2 2
Blocks sum rank 2
12 16 24 28
shape 2 2

Built-in primitives for programming contests include sliding windows, Fenwick trees, segment trees and priority queues. Lazy ranges and generators let you process sequences without first storing every element.

Compile to Rust

Lazy sequences and array operations can be fused into efficient loops without intermediate arrays.

AI-assisted compilation turns Rank programs into standalone Rust. Generated agent prompts carry the source, AST, type and loop analysis, tests and optimization guidance. The resulting Rust is checked against the original Rank program on the same test inputs.

Rust workflow →

Notable examples