sparge
Translation status: ภาษาไทย reader-locale proof. Code fences render through the th-TH pipeline; prose is canonical Latin.
Spreads an array or collection literal into its surrounding expression.
Aliases: ...
Syntax: sparge <expression>
Category#
collection
Related#
Examples#
radix/corpus/sparge/sparge.fab (canonical · keyword)#
Spreads an array or collection literal into its surrounding expression.
# =============================================================================
# sparge — Spreads an array or collection literal into its surrounding expression.
# =============================================================================
#
# What this teaches:
# • Spread syntax — how to splice a collection into a list literal or function call
# • Collection composition — building larger expressions by expanding collections inline
#
# Common mistakes:
# • confusing sparge (splice) with appende, or using sparge on a non-collection expression
#
# See also: lista
# =============================================================================
# sparge — spread a collection into another collection or call
#
# [a, sparge <lista>, b] -- splice into list literal
# functio(sparge <lista>) -- spread call arguments
#
# GRAMMAR:
# spargeExpr :← 'sparge' expr
#
# EXPECTED OUTPUT:
# 1, 2, 3, 4 (expanded list elements).
main {
const _ media ← [2, 3]
# → [1, 2, 3, 4]
const _ numeri ← [1, spread media, 4]
for from numeri const n {
print n
}
}Expected output:
1
2
3
4