Renderingla

ceteri

Collects remaining parameters, operands, or extracted fields.

Aliases: rest

Syntax: ceteri <type> <name>

Category

function

Related

Examples

examples/corpus/ceteri/ceteri.fab (canonical · keyword)

Collects remaining parameters, operands, or extracted fields.

# ceteri — rest parameter (collects remaining arguments)
#
# functio <nomen>(ceteri <typus> <nomen>) → <typus>
#
# GRAMMAR:
#   param :← 'ceteri' type ident
#
# EXPECTED OUTPUT:
#   none

functio summa(ceteri lista<numerus> numeri) → numerus {
    varia _ total ← 0

    itera ex numeri fixum n {
        total ← total + n
    }

    redde total
}

incipit {
    # ceteri receives the whole lista
    nota summa([1, 2, 3, 4])
}

Expected output:

10