Reference

Calculations

Pure functions with inputs, outputs, and assignment-style bodies.

Summary

A calculation is a pure function: no touches metadata, no await, no filesystem or network by default.

Syntax

calculation annual price
  input monthly price: Int
  output annual price: Int
  annual price is monthly price * 12

Body forms include input, output, {name} is {expr}, for each, add to / subtract from / set to, and return.

Semantics

Inputs are required at call sites. The output name defines the result binding inside the body. Calculations may call other pure calculations and use operators, literals, lists, and records.

Compiler note

Calculations are pure: the checker rejects effects and await inside the body. Callable names with spaces are normalized internally; semantic refs keep author spelling.

Example

From examples/math.point:

calculation annual price
  input monthly price: Int
  output annual price: Int
  annual price is monthly price * 12

Common mistakes

  • Using await or calling actions inside a calculation
  • Return type does not match output declaration (return-type-mismatch, type-mismatch)

Agent diagnostic notes

  • Ref shape: point://semantic/Math/calculation.annual price
  • Tests are calculations whose name starts with test and return Bool (see point test)

See also