Kết xuấtvi

tập_hợp

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Generic set collection type.

Aliases: set

Syntax: tập_hợp<T>

Category#

collection

Examples#

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

Generic set collection type.

# =============================================================================
# tập_hợp — Generic set collection type
# =============================================================================
#
# What this teaches:
#   • Generic set collection type.
#   • Related keywords: danh_sách, bảng, ∈
#
# Common mistakes:
#   • Using `tập_hợp<T>` without an explicit type — `tập_rỗng` requires an explicit type annotation like `tập_hợp<số>` (SEM014).
#
# See also: danh_sách, bảng, ∈
# =============================================================================

# tập_hợp<T> basic intrinsics
#
# Compiler-owned tập_hợp<T> methodi — adde, habet, dele, longitudo, tập_rỗng.
#
# GRAMMAR:
#   copia.add(x) | copia.has(x) | copia.delete(x)
#   copia.length() | copia.is_empty()
#
# tập_hợp<T> is a set-like collection; tập_rỗng with tập_hợp<T> creates an empty set.
#
# EXPECTED OUTPUT:
#   Smoke asserts exit 0 only.
#
# BACKEND: Go e2e whitelist — tập_hợp method surface not yet lowered for Go.

main {
    var set<int> numeri ← empty
    numeri.add(1)
    numeri.add(2)
    numeri.add(3)
    const bool habetduo ← numeri.has(2)
    const bool remotus ← numeri.delete(3)
    const int longitudo ← numeri.length()
    const bool vacuaest ← numeri.is_empty()
    print habetduo, remotus, longitudo, vacuaest
}