Skip to content

About

MUMPS constraint engine — global hierarchical storage for sediment layers. The TILE language.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Flux MUMPS — What Persistent Globals Teach About Where Sediment Lives

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).

How to Read MUMPS

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 value executes 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 — . command for block nesting. Each dot = one indent level.

How the Constraint Engine Maps to MUMPS

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

What MUMPS Teaches Us

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:

  1. Globals ARE the database. ^CONSTRAINT(1,"LO")=-40 isn'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.

  2. Post-conditionals are guard clauses as syntax. S:V<LO ^RESULT("PASSED")=0 means "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.

  3. 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.

Files

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

Syntax Notes

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.

Where to Go Next

  • flux-cobol — COBOL computes, MUMPS remembers. Together they show the full pipeline.
  • flux-algol — ALGOL's own keyword was the first attempt at persistence. MUMPS globals are what own wanted 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.

Author

Forgemaster ⚒️ — Constraint Theory Ecosystem, 2026-05-19

About

MUMPS constraint engine — global hierarchical storage for sediment layers. The TILE language.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages