All executable code is supplied as part of a function definition. The syntax is
function-definition: function-name-part function-arg-ret { statements } function-name-part: identifier function-name-part.identifierThe syntax of the statements in a function will be discussed in Statements. As a brief example:
add_one (a : int) : int { return a+1; }is a simple function that might be part of the top level of a module.
Functions that are declared within an adt
use the qualified form of definition:
Point : adt { x, y : int; add : fn (p : Point, q : Point) : Point; eq : fn (p : Point, q : Point) : int; } . . . Point.add (p : Point, q : Point) : Point { return Point (p.x+q.x, p.y+q.y); }