Renderingen-US

map

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Generic key/value map type.

Aliases: map, dictionary

Syntax: tabula<K,V>

Category#

collection

Examples#

radix/corpus/tabula/methodi-accessus.fab (canonical · keyword)#

Generic key/value map type.

# =============================================================================
# tabula — Generic key/value map type.
# =============================================================================
#
# What this teaches:
#   • Map access methods — `accipe`, `ponde`, `habet`, `dele`, `longitudo`, `vacua`
#   • Null-safe access — using `vel` to supply defaults when a key is absent
#
# Common mistakes:
#   • attempting to access a missing key without a default and getting a ∪ nihil value — use vel for fallback
#
# See also: lista, copia, ∷, itera
# =============================================================================




# tabula<K,V> access and mutation intrinsics
#
# puncta.put(k, v) | puncta.get(k) | puncta.has(k)   -- get/put
# puncta.delete(k) | puncta.length() | puncta.is_empty()      -- delete/size
#
# GRAMMAR:
#   mapMethod :← expr '.' ('pone' | 'accipe' | 'habet' | 'dele'
#                         | 'longitudo' | 'vacua') '(' args? ')'
#
# EXPECTED OUTPUT:
#   No pinned stdout — smoke asserts exit 0; tabula/tabula.fab carries scalar contract.
#
# BACKEND: Wasm tier floor FrontendAnalyzed (method surface not yet Runnable;
# whitelist: tabula/methodi-accessus.fab).

main {
    var map<string, int> puncta  empty
    puncta.put("aelia", 95)
    puncta.put("balbus", 87)

    const _ aelia  puncta.get("aelia")
    const _ absens  puncta.get("carus")
    const _ carus  puncta.get("carus") coalesce 0
    const _ habetbalbum  puncta.has("balbus")
    const _ remotus  puncta.delete("balbus")
    const _ longitudo  puncta.length()
    const _ vacuaest  puncta.is_empty()

    print aelia, absens, carus, habetbalbum, remotus, longitudo, vacuaest
}

Expected output:

95 nihil 0 verum verum 1 falsum

radix/corpus/tabula/tabula.fab (canonical · keyword)#

Generic key/value map type.

# =============================================================================
# tabula — Generic key/value map type.
# =============================================================================
#
# What this teaches:
#   • Map declaration — `tabula<K,V>` with bracket syntax for keyed access
#   • Map literals — empty map via `vacua`, then populating with index assignment
#
# Common mistakes:
#   • using bracket syntax with a key type that doesn't match the tabula declaration, or inserting duplicate keys
#
# See also: lista, copia, ∷, itera
# =============================================================================




# tabula<K,V> declaration, vacua, and keyed lookup
#
# varia tabula<K,V> nomen ← vacua   -- typed empty map (forma innata)
# nomen[key] ← value                -- index assignment
# nomen[key]                        -- keyed accipe
# nomen.length()                 -- entry count
#
# GRAMMAR:
#   mapDecl :← 'varia' 'tabula<' type ',' type '>' ident '←' expr
#   mapAcc  :← expr '[' expr ']'
#
# EXPECTED OUTPUT:
#   longitudo() plus keyed lookups for alpha/beta/gamma (tabula.expected).

main {
    var map<string, int> puncta  empty
    puncta["alpha"]  1
    puncta["beta"]  2
    puncta["gamma"]  3

    print puncta.length()
    print puncta["alpha"]
    print puncta["beta"]
    print puncta["gamma"]
}

Expected output:

3
1
2
3