العرضar

generic

Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.

Generic functions with angle-bracket type and حجم parameters.

Syntax: دالة <name><T, حجم N>(<params>) → <type> <block>

Category#

type

Examples#

radix/corpus/generic/generic.fab (canonical · concept)#

Generic functions with angle-bracket type and حجم parameters.

# =============================================================================
# generic — Generic functions with angle-bracket type and حجم parameters
# =============================================================================
#
# What this teaches:
#   • Generic functions with angle-bracket type and حجم parameters.
#   • Related keywords: دالة, صنف, حجم
#
# Common mistakes:
#   • Type parameter not satisfying bounds — generic parameters must meet any constraints declared on the generic function or صنف.
#
# See also: دالة, صنف, حجم
# =============================================================================

# Generic functions with angle-bracket type parameters
#
# Type and size parameters appear in `<...>` before value parameters.
#
# GRAMMAR:
#   funcDecl :← 'دالة' ident genericParams? '(' valueParams ')' ...
#   genericParams :← '<' (ident | 'حجم' ident) (',' (ident | 'حجم' 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 ∪ none {
    return res.first()
}

main {
    print "generic function signatures paratae"
}

Expected output:

generic function signatures paratae