Skip to main content
A function takes values and gives one value. It reads only its arguments, its constants and its tables. So the same arguments give the same value on every machine, every time. Rate tables, calculations and rounding live in functions. A rating calculation, a refund and an eligibility test are each a function.

Function parts

In RSL 0.4.2, a file with component: rater states one function. A file that leaves component out does too: This file is the smallest function that passes the check. It takes a payroll and gives a premium:
minimal/rater.rsl
Each calculation reads inputs, constants, tables and other calculations. RSL orders the calculations by what each one reads, so the order in the file is free.

Checks

A check is a condition on an input, a list or a record. A call whose input breaks a check gets a refusal in place of a value. This check of a staffing rating function refuses a payroll under $1,000:
The function checks every input before it calculates. Once each check passes, every calculation gives a value. A process that calls the function reads a refusal with a code as the Declined case of the result.