lista
Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.
Generic ordered collection type.
Aliases: array, list
Syntax: lista<T>
Category#
collection
Related#
Examples#
radix/corpus/lista/lista.fab (canonical · keyword)#
Generic ordered collection type.
# =============================================================================
# lista — Generic ordered collection type.
# =============================================================================
#
# What this teaches:
# • lista literal syntax — `[elem, ...]` with typed empty collections using `vacua`
# • the `sparge` operator — splicing one list into another literal
# • basic access: `longitudo()` and indexed reads via `[n]`
#
# Common mistakes:
# • Using vacua without an explicit type annotation — vacua requires a declared collection type like lista<T>.
#
# See also: tabula, copia, ∷, itera
# =============================================================================
# lista<T> literals, vacua, and sparge (long-form types — default Faber readability).
# Numeric/tensor modules may use lf32/lu32 sugar; see docs/design/numeric-type-sugar.md.
#
# lista<T> nomen ← vacua -- typed empty collection (forma innata)
# fixum _ nomen ← [elem, …] -- list literal
# [sparge expr, …] -- splice into literal
#
# GRAMMAR:
# listDecl :← ('varia' | 'fixum') 'lista<' type '>' ident '←' expr
# listLit :← '[' (expr | sparge)* ']'
#
# EXPECTED OUTPUT:
# Scalar longitudo() and indexed accipe only (lista.expected).
main {
const list<int> vacuares ← vacua
const _ numeri ← [1, 2, 3, 4, 5]
const _ nomina ← ["Marcus", "Julia", "Gaius"]
const _ vexilla ← [true, false, true]
const _ matrix ← [[1, 2], [3, 4], [5, 6]]
const _ prima ← [1, 2, 3]
const _ secunda ← [4, 5, 6]
const _ coniuncta ← [spread prima, spread secunda]
const _ aucta ← [0, spread prima, 99]
print vacuares.longitudo()
print numeri.longitudo()
print numeri[0]
print numeri[4]
print nomina.longitudo()
print nomina[1]
print vexilla[0]
print vexilla[2]
print matrix.longitudo()
print matrix[1][0]
print coniuncta.longitudo()
print aucta.longitudo()
print aucta[0]
print aucta[4]
}Expected output:
0
5
1
5
3
Julia
verum
verum
3
3
6
5
0
99
radix/corpus/lista/methodi-copiae.fab (canonical · keyword)#
Generic ordered collection type.
# =============================================================================
# lista — Generic ordered collection type.
# =============================================================================
#
# What this teaches:
# • copy, slice, and reordering intrinsics — `addita()`, `sectio()`, `prima()`, `ultima()`
# • ordering operations — `inversa()`, `ordinata()`
#
# Common mistakes:
# • Forgetting that sectio(lo, hi) uses an exclusive hi bound — the returned slice may be shorter than expected.
#
# See also: tabula, copia, ∷, itera
# =============================================================================
# lista<T> copy, slice, and ordering intrinsics
#
# res.addita(x) | res.sectio(lo, hi) | res.prima(n) | res.ultima(n) -- views
# res.omissa(n) | res.inversa() | res.ordinata() -- reorder
#
# GRAMMAR:
# listMethod :← expr '.' ('addita' | 'sectio' | 'prima' | 'ultima'
# | 'omissa' | 'inversa' | 'ordinata') '(' args? ')'
#
# EXPECTED OUTPUT:
# [1, 2, 3, 4, 5, 6]
# [2, 3, 4]
# [1, 2]
# [4, 5]
# [3, 4, 5]
# [5, 4, 3, 2, 1]
# [1, 2, 3]
#
# BACKEND: Go e2e whitelist — lista intrinsic methods not yet lowered for Go
# (whitelist: lista/methodi-copiae.fab).
main {
const _ res ← [1, 2, 3, 4, 5] ∷ list<int>
const _ addita ← res.addita(6)
const _ sectio ← res.sectio(1, 4)
const _ primaduo ← res.prima(2)
const _ ultimaduo ← res.ultima(2)
const _ omissaduo ← res.omissa(2)
const _ inversa ← res.inversa()
const _ ordinata ← [3, 1, 2].ordinata()
print addita
print sectio
print primaduo
print ultimaduo
print omissaduo
print inversa
print ordinata
}Expected output:
[1, 2, 3, 4, 5, 6]
[2, 3, 4]
[1, 2]
[4, 5]
[3, 4, 5]
[5, 4, 3, 2, 1]
[1, 2, 3]
radix/corpus/lista/methodi-mutatio.fab (canonical · keyword)#
Generic ordered collection type.
# =============================================================================
# lista — Generic ordered collection type.
# =============================================================================
#
# What this teaches:
# • mutation intrinsics for lists — `appende()`, `decapita()`, `detrahe()`, `inverte()`, `ordina()`
# • contrast between mutation methods and copy-returning participle forms
#
# Common mistakes:
# • Expecting mutation methods (appende, inverte, ordina) to return a new list — they mutate in place and do not return a value.
#
# See also: tabula, copia, ∷, itera
# =============================================================================
# lista<T> mutation intrinsics
#
# res.appende(x) | res.decapita() | res.detrahe() | res.inverte() | res.ordina()
#
# GRAMMAR:
# listMethod :← expr '.' ('appende' | 'decapita' | 'detrahe' | 'inverte' | 'ordina') '(' args? ')'
#
# EXPECTED OUTPUT:
# [1, 2]
# 3
# 4
#
# BACKEND: Go e2e whitelist — lista intrinsic methods not yet lowered for Go
# (whitelist: lista/methodi-mutatio.fab).
main {
var _ res ← [3, 1, 2] ∷ list<int>
res.appende(4)
const _ primusremotus ← res.decapita()
const _ ultimusremotus ← res.detrahe()
res.inverte()
res.ordina()
print res
print primusremotus
print ultimusremotus
}Expected output:
[1, 2]
3
4