.lmc — Constraint Solver | LMX

LMX // .LMC

.lmcConstraint Solver

Declare variables + equations; solve for the unknowns from what you know.

  • Runs here
  • a .lmc file
  • free to run
WHAT IT IS

Why .lmc exists.

A declarative calculator: declare VARs and EQUATIONs, supply the values you know, and the solver iterates to fill in the rest. (Interactive prompts are replaced by the inputs you pass.)

Runs here

This one runs in the browser sandbox with no account, and offline in the CLI.


A WORKED EXAMPLE

Ohm's Law Calculator

Takes inputs — Known values as inputs: ["I=2", "R=3"] (or an object { I: 2, R: 3 })..

# Ohm's Law Calculator
# inputs: I=2, R=3
TITLE "Ohm's Law Calculator (V = I * R)"

# Define the variables
VAR V Voltage
VAR I Current
VAR R Resistance

# Define the relationships between the variables
EQUATION V = I * R
EQUATION I = V / R
EQUATION R = V / I
Run it

SYNTAX

The shape of it.

Straight from the interpreter catalogue — the same summary the editor shows as a placeholder.

TITLE "Ohm's Law (V = I * R)"
VAR V Voltage
VAR I Current
VAR R Resistance
EQUATION V = I * R

NEXT

Where to take it.