रेंडरिंगhi

समुच्चय

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.

Generic set collection type.

Aliases: set

Syntax: समुच्चय<T>

Category#

collection

Examples#

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

Generic set collection type.

# =============================================================================
# समुच्चय — Generic set collection type
# =============================================================================
#
# What this teaches:
#   • Generic set collection type.
#   • Related keywords: सूची, तालिका, ∈
#
# Common mistakes:
#   • Using `समुच्चय<T>` without an explicit type — `खाली` requires an explicit type annotation like `समुच्चय<संख्या>` (SEM014).
#
# See also: सूची, तालिका, ∈
# =============================================================================

# समुच्चय<T> basic intrinsics
#
# Compiler-owned समुच्चय<T> methodi — adde, habet, dele, longitudo, खाली.
#
# GRAMMAR:
#   copia.add(x) | copia.has(x) | copia.delete(x)
#   copia.length() | copia.is_empty()
#
# समुच्चय<T> is a set-like collection; खाली with समुच्चय<T> creates an empty set.
#
# EXPECTED OUTPUT:
#   Smoke asserts exit 0 only.
#
# BACKEND: Go e2e whitelist — समुच्चय 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
}