function calls

Function calls use a name followed by parentheses. Most functions take positional arguments, some are variadic, and a few require labeled arguments.

Positional and variadic arguments

x = abs(-42)
y = max(1, 3, 42, 12)

show summary "" with x, y

Variadic functions accept a variable number of positional arguments.

Labeled arguments

Some built-in functions require labeled arguments. Labeled arguments are newline-separated and cannot be mixed with positional arguments. User-defined functions only support positional arguments.

table Items[Id] = with
  [| as Id |]
  [| "kit" |]
  [| "partA" |]

table BOM = with
  [| as RawId, as PartId, as Quantity |]
  [| "kit", "partA", 2 |]

expect BOM.Id = BOM.RawId

table Orders = with
  [| as Uid, as Quantity |]
  [| "kit", 3 |]

expect Orders.Id = Orders.Uid

table T = extend.billOfMaterials(
  Item: Items.Id,
  Part: BOM.PartId,
  Quantity: BOM.Quantity,
  DemandId: Orders.Uid,
  DemandValue: Orders.Quantity)

show table "" with
  Items.Id
  T.DemandId
  T.Quantity

Namespaced function names

Some built-in functions include a dot in their name for namespacing, for example lastForex. The dot is purely a naming convention and has no special semantics.

See also

User Contributed Notes
0 notes + add a note