generic
Translation status: العربية reader-locale proof. Code fences render through the ar pipeline; prose is canonical Latin.
Generic functions with angle-bracket type and magnitudo parameters.
Syntax: functio <name><T, magnitudo N>(<params>) → <type> <block>
Category#
type
Related#
Examples#
radix/corpus/generic/generic.fab (canonical · concept)#
Generic functions with angle-bracket type and magnitudo parameters.
# =============================================================================
# generic — Generic functions with angle-bracket type and magnitudo parameters
# =============================================================================
#
# What this teaches:
# • Generic functions with angle-bracket type and magnitudo parameters.
# • Related keywords: functio, genus, magnitudo
#
# Common mistakes:
# • Type parameter not satisfying bounds — generic parameters must meet any constraints declared on the generic function or genus.
#
# See also: functio, genus, magnitudo
# =============================================================================
# Generic functions with angle-bracket type parameters
#
# Type and size parameters appear in `<...>` before value parameters.
#
# GRAMMAR:
# funcDecl :← 'functio' ident genericParams? '(' valueParams ')' ...
# genericParams :← '<' (ident | 'magnitudo' ident) (',' (ident | 'magnitudo' ident))* '>'
#
# EXPECTED OUTPUT:
# generic function signatures paratae
#
# BACKEND: Generic call codegen gap on Rust (`T: Clone`; whitelist: generic/generic.fab).
# Call sites are deferred in this smoke exemplar.
fn identitas<T>(T value) → T {
return value
}
fn primum<T>(list<T> res) → T ∪ null {
return res.primus()
}
main {
print "generic function signatures paratae"
}Expected output:
generic function signatures paratae