Renderingla

generics

Angle-bracket generic parameters on functions and declarations.

Aliases: type parameters, magnitudo

Syntax: functio name<T>(...) | genus Name<T, magnitudo N>

Category

type

Related

Examples

examples/corpus/prae/prae.fab (canonical · concept)

Angle-bracket generic parameters on functions and declarations.

# generics — angle-bracket parameters (replaces removed prae typus)
#
# GRAMMAR:
#   genericParams :← '<' (ident | 'magnitudo' ident) (',' (ident | 'magnitudo' ident))* '>'
#
# EXPECTED OUTPUT:
#   No incipit — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only generic surface (whitelist: prae/prae.fab). Cross-ref: generic/generic.fab.
#

functio identitas<T>(T valor) → T {
    redde valor
}

functio primum<T>(lista<T> res) → T ∪ nihil {
    redde res.primus()
}

Expected output: