Spatial languages: Writing code in 2D
Comments
2026-07-22 I guess expressions donβt really need to read left-to-right on a line. Why canβt a v v v "Hello World!" :v ^,_@
Orca is a livecoding sequencer where every letter is an operator that reads its neighbors: A adds the value to its left and the value to its right, and writes the sum directly below itself. Sound familiar? 1A2 .3.
Racketβs #2dcond
A real, shipping language extension: Racketβs #2dcond is a cond evaluated in two dimensions. The left column tests b, the top row tests a, and the cell where both are true runs.
#lang 2d racket
(require 2d/cond)
(define (same? a b)
#2dcond
βββββββββββββββ¦ββββββββββββββββββββββββ¦ββββββββββββββ
β β (pair? a) β (number? a) β
β ββββββββββββββ¬ββββββββββββββββββββββββ¬ββββββββββββββ£
β (pair? b) β (and (same? (car a) β #f β
β β (car b)) β β
β β (same? (cdr a) β β
β β (cdr b))) β β
β ββββββββββββββ¬ββββββββββββββββββββββββ¬ββββββββββββββ£
β (number? b) β #f β (= a b) β
βββββββββββββββ©ββββββββββββββββββββββββ©ββββββββββββββ)
Hexagony
Hexagony runs on a pointy-topped hexagonal grid, like a certain background you may have noticed. Six instruction pointers start at the six corners. Hello world:
H ; e ; l ; d ; * ; r ; o ; W l ; ; o ; * 4 3 3 ; @ . > ; 2 3 < \ 4 ; * /
Ladder Logic
Ladder logic is how PLCs run factories (and, done properly, chicken coop doors): each rung is a relay circuit read rail-to-rail, and parallel branches are OR. This classic seal-in rung computes Run = (Start OR Run) AND (NOT Stop):
--+----[ ]--+----[\]----( )
| Start | Stop | Run
| | |
+----[ ]--+
Run
Spreadsheet
And an honorable mention for the most successful spatial language of all time: the spreadsheet, where every formula lives at a 2D coordinate and reads its neighbors.
The Sapir-Whorf Connection
If you know me, you know I love bringing up the Sapir-Whorf hypothesis, which proposes that language shapes the way you think. Likewise, I believe technology shapes which languages emerge. Being aware of our biases is a justified mental exercise, at least according to David Foster Wallace, who delivered a commencement speech titled This Is Water. Though his speech was less about ancilla uncomputation in quantum circuits and maybe more about growing up and being compassionate, you get the point. By challenging our habits, we can explore new ideas.
Comments
No comments yet. Start the discussion.