Example programs
These aren't written for this documentation - they're the actual programs in tests/programs, which the interpreter's own snapshot test suite (python -m src.Main test, see the CLI reference) runs against on every change. Reading them is a good way to see idiomatic Falx at a slightly larger scale than the tutorials.
Closures used as private-state "objects" - deposit, withdraw and a running transaction log, all without a single struct.
closuresfunctionsA cart built from closures, with a configurable discount calculator and item totals.
closuresarraysStructs for products, a map keyed by SKU, and the keys()-plus-indexing pattern for iterating key/value pairs.
structsmapsarraysThe smallest possible require() example - a struct defined in player.flx and used from main.flx. See it walked through in the structs-and-modules tutorial.
modulesstructsA Task struct plus a closure-based scheduler that adds, completes and filters tasks by priority.
structsclosuresarraysWord-frequency counting over a block of text, using a WordStat struct and string methods like split() and toLower().
structsstringsarraysSmall numeric helpers - weighted averages, score normalization - chained together.
functionsnumbersThe single most comprehensive example in the test suite: structs, maps, arrays, null checks, loops and closures combined in one program.
structsmapsarraysclosuresThe same four arithmetic operations as the calculator tutorial, plus a createScaledOp() closure that wraps any operation with a scale factor.
functionsclosuresA short, ten-line demonstration of one function returning several independently-configured closures.
closuresComposable prefix/suffix closures chained into a small text-formatting pipeline.
closuresstringsA six-line micro-example of building a string with + inside a while loop.
whilestrings.out file next to it in the repository with the exact expected output - a quick way to check your own local interpreter build behaves the same way.