vocatio
Translation status: हिन्दी reader-locale proof. Code fences render through the hi pipeline; prose is canonical Latin.
Function, method, chained, and sparge spread call expressions.
Syntax: <name>(<args>) | <expr>.<method>(<args>) | <name>(sparge <lista>)
Category#
expression
Related#
Examples#
radix/corpus/vocatio/vocatio.fab (canonical · concept)#
Function, method, chained, and sparge spread call expressions.
# =============================================================================
# vocatio — Function, method, chained, and sparge spread call expressions.
# =============================================================================
#
# What this teaches:
# • Call expressions — function calls, method calls, and chained fluent interface calls
# • Spread arguments — `sparge <lista>` expands a list into positional call arguments
#
# Common mistakes:
# • confusing vocatio (function-call expression) with functio declaration syntax — vocatio is the call site, not the definition
#
# See also: functio, sparge, genus
# =============================================================================
# vocatio — function and method call expressions
#
# <nomen>() -- zero-arg call
# <nomen>(<args>) -- positional arguments
# <expr>.<method>(<args>) -- method call on receiver
# <expr>.<m1>().<m2>() -- chained calls (fluent interface)
# <nomen>(sparge <lista>) -- spread arguments into call
#
# GRAMMAR:
# callExpr :← expr '(' (expr | sparge expr)* ')'
#
# EXPECTED OUTPUT:
# Salve, arithmetic results, chained builder output, spread-arg sum.
fn saluta() {
print "Salve!"
}
fn adde(int a, int b) → int {
return a + b
}
fn multiplica(int x, int y) → int {
return x * y
}
class Computator {
int valor = 0
fn pone(int n) → Computator {
self.valor ← n
return self
}
fn duplica() → Computator {
self.valor ← self.valor * 2
return self
}
fn accipe() → int {
return self.valor
}
}
main {
# Simple call (no arguments)
saluta()
# Call with arguments
const _ summa ← adde(10, 20)
# 30
print summa
# Multiple arguments
const _ productum ← multiplica(5, 6)
# 30
print productum
# Method call on objectum
var _ computator ← Computator {}
computator.pone(10)
# 10
print computator.accipe()
# Chained method calls
var _ alter ← Computator {}
const _ value ← alter.pone(5).duplica().duplica().accipe()
# 20
print value
# Call with sparge
const list<int> numeri ← [3, 7]
const _ sparsa ← adde(spread numeri)
# 10
print sparsa
}Expected output:
Salve!
30
30
10
20
10