渲染zh-Hant

copia

Translation status: 繁體中文 reader-locale proof. Code fences render through the zh-Hant pipeline; prose is canonical Latin.

Generic set collection type.

Aliases: set

Syntax: copia<T>

Category#

collection

Examples#

radix/corpus/intrinseca/copia-fundamenta.fab (canonical · keyword)#

Generic set collection type.

# =============================================================================
# copia — Generic set collection type
# =============================================================================
#
# What this teaches:
#   • Generic set collection type.
#   • Related keywords: lista, tabula, inter
#
# Common mistakes:
#   • Using `copia<T>` without an explicit type — `vacua` requires an explicit type annotation like `copia<numerus>` (SEM014).
#
# See also: lista, tabula, inter
# =============================================================================

# copia<T> basic intrinsics
#
# Compiler-owned copia<T> methodi — adde, habet, dele, longitudo, vacua.
#
# GRAMMAR:
#   copia.adde(x) | copia.habet(x) | copia.dele(x)
#   copia.longitudo() | copia.vacua()
#
# copia<T> is a set-like collection; vacua with copia<T> creates an empty set.
#
# EXPECTED OUTPUT:
#   Smoke asserts exit 0 only.
#
# BACKEND: Go e2e whitelist — copia method surface not yet lowered for Go.

main {
    var set<int> numeri  vacua

    numeri.adde(1)
    numeri.adde(2)
    numeri.adde(3)

    const _ habetduo  numeri.habet(2)
    const _ remotus  numeri.dele(3)
    const _ longitudo  numeri.longitudo()
    const _ vacuaest  numeri.vacua()

    print habetduo, remotus, longitudo, vacuaest
}