Hasty Briefsbeta

Bilingual

Spatial languages: Writing code in 2D

7 hours ago
  • The article proposes using 2D spatial notation for programming expressions, allowing vertical writing of infix operators.
  • Introduces `andFlip`, a 3-arity operator that toggles a target when both inputs are true, motivating vertical chaining.
  • Shows how vertical chaining can reset mutable variables within the same expression, inspired by quantum computing's ancilla uncomputation.
  • Demonstrates a 3-bit adder using spatial operators `maj` and `uma`, which clean up after themselves.
  • Lists existing spatial languages: Befunge, Orca, Racket's #2dcond, Hexagony, and Ladder logic.
  • Argues that spatial notation can make code more intuitive and challenges the bias toward linear code.