MUMPS (Massachusetts General Hospital Utility Multi-Programming System, 1966) runs VA hospitals, Epic healthcare systems, and banking backends. It's a language with a built-in hierarchical database. This repo implements the Flux constraint engine in MUMPS (ANSI X11.1-1995 / ISO 11756).
MUMPS is sparse, column-sensitive, and string-centric. Commands are one letter. Globals persist to disk by default. Most developers have never seen it — here's the crash course.
; This is a comment (starts with ;)
ROUTINENAME ; Entry point
N X,Y ; NEW — create local variables (like let/const)
S X=42 ; SET — assignment
S X=X+1 ; Increment
W "hello",! ; WRITE — output (! = newline)
Q ; QUIT — return from routine
;
; Post-conditionals: execute command only if condition is true
S:X>10 Y=1 ; SET Y=1 only if X>10
W:X<0 "negative" ; WRITE only if X<0
;
; For loops
F I=1:1:10 D ; D = DO (execute block)
. W I,! ; Dot-syntax for nesting (each dot = indent level)
;
; Globals — persist across sessions in the M database
S ^PATIENT(123,"NAME")="Smith"
S ^PATIENT(123,"DOB")="19600101"
; ^VAR = global, stored on disk, survives process exits
;
; $ORDER — traverse globals in sorted order
N IDX S IDX=""
F S IDX=$O(^PATIENT(IDX)) Q:IDX="" D
. W ^PATIENT(IDX,"NAME"),!
;
; $PIECE — split strings by delimiter
S DATA="red,green,blue"
W $P(DATA,",",2) ; outputs: green
;
; $GET — safe access with default
S VAL=$G(^CONFIG("MAX"),100) ; default 100 if not set
;
; Functions
MYFUNC(X,Y) ;
Q X+Y ; QUIT with value = return
;
; External calls
D PROCESS^OTHERROUTINE(arg) ; DO external routine
S RESULT=$$CALC^MATH(a,b) ; $$ = extrinsic function call
Key ideas:
- Commands are 1 letter: S=Set, K=Kill, N=New, W=Write, R=Read, Q=Quit, D=Do, F=For, I=If
- Globals (
^VAR) persist in a hierarchical database — they survive process exits, crashes, and restarts - No data types — everything is a string, numbers auto-coerce
- Post-conditionals —
S:condition valueexecutes only when condition is true. Guard clauses as syntax. - $ORDER — the universal traversal primitive. Replaces array iteration, tree traversal, dictionary enumeration.
- $PIECE — the universal parsing primitive. Split strings by delimiter.
- Dot-syntax —
. commandfor block nesting. Each dot = one indent level.
| Constraint Engine Concept | MUMPS Mechanism |
|---|---|
| Constraint bounds storage | Globals: ^FLX("C",1,"LO")=-40 |
| Sediment layers | Globals: ^FLXSED(1,"NLO")=-35 — persists across sessions |
| Error mask | String: "10100000" — position = constraint index |
| INT8 saturation | Comparison + clamping (no types to overflow) |
| BFS fracture | $ORDER traversal of adjacency globals |
| Guard clauses | Post-conditionals: S:V<LO RESULT("PASSED")=0 |
| Pipeline stages | Labels with D LABEL^ROUTINE calls |
FLXCHECK.m — Core constraint checking with INT8 saturation and sediment
FLXFRACT.m — Fracture engine: BFS via $ORDER traversal
FLXSEDIMNT.m — Sediment layer manager with global persistence
FLXMAIN.m — Main program wiring the full pipeline
MUMPS is the TILE language — where sediment actually lives. COBOL is the frozen constraint engine: compiled, static, batch-processed. MUMPS is where the sediment layers persist: in global variables that survive sessions, shared between processes, outliving crashes.
Every ^FLXSED(layer,"NLO")=newLo is a sediment correction written to disk by default. Every validation cycle reads the accumulated state. This IS the tile architecture: data lives in a hierarchical global store, corrections accumulate in layers, and the engine reads the current composite state.
COBOL computes. MUMPS remembers. The constraint engine needs both.
Three specific lessons:
-
Globals ARE the database.
^CONSTRAINT(1,"LO")=-40isn't just a variable — it's a database node. It persists across sessions, survives crashes, and is shared across processes. There is no separate database layer. The healthcare industry has been doing accumulated correctness this way since 1966 — VA VistA holds 30+ years of patient data in MUMPS globals. -
Post-conditionals are guard clauses as syntax.
S:V<LO ^RESULT("PASSED")=0means "if value is below lower bound, mark as failed." No if/else nesting needed. The post-conditional IS the constraint check. This makes each constraint a one-liner with zero nesting. -
No types means no type fights. Numbers auto-coerce:
"42"+1=43. INT8 saturation becomes a comparison, not a type cast. You never fight the type system to express a constraint. This is genuinely freeing — the constraint logic is pure, unmediated comparison.
| File | Purpose |
|---|---|
FLXCHECK.m |
Core constraint checking with INT8 saturation and sediment |
FLXFRACT.m |
Fracture engine: BFS via $ORDER traversal |
FLXSEDIMNT.m |
Sediment layer manager with global persistence |
FLXMAIN.m |
Main program wiring the full pipeline |
Standard MUMPS (ANSI X11.1-1995 / ISO 11756). Routine entry points are labels at column 1. Commands indented (4 spaces standard). ^GLOBAL = persistent database variable. $G(var,default) = safe get. $O(global(x)) = ordered traversal. $P(str,delim,piece) = string parsing.
- flux-cobol — COBOL computes, MUMPS remembers. Together they show the full pipeline.
- flux-algol — ALGOL's
ownkeyword was the first attempt at persistence. MUMPS globals are whatownwanted to be. - flux-snobol — SNOBOL4 shares MUMPS' string-centric worldview but adds pattern matching as control flow.
- flux-docs — Full documentation: error masks, fracture-coalesce, sediment, thermodynamic analogy.
Forgemaster ⚒️ — Constraint Theory Ecosystem, 2026-05-19