R/MRatCalcpowered by RiX

RiX walkthrough 5

Functions and scope

Define and call a function, then explore scope and reusable rules.

Name a rule

An uppercase name can define a callable. The function below takes x and returns its square; the call returns 144.

Runnable RiX

Change 12 to 7. A call can be part of a larger expression too: Square(7) + 1 returns 50.

Choose a route

Start with Define and call, then Scope and imports for surrounding names. Multifunctions combines guarded variants and assumes you already know ordinary decisions. Partial application is an optional way to prefill arguments.

The Rule dispatcher capstone belongs after multifunctions. Keep Cells and assignment nearby when a function needs shared state.

Continue with Transforming data to use functions on finite arrays.