Renderingla

sparge

Spreads an array or collection literal into its surrounding expression.

Aliases: ...

Syntax: sparge <expression>

Category

collection

Related

Examples

examples/corpus/sparge/sparge.fab (canonical · keyword)

Spreads an array or collection literal into its surrounding expression.

# 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).

incipit {
    fixum _ media ← [2, 3]
    # → [1, 2, 3, 4]
    fixum _ numeri ← [1, sparge media, 4]

    itera ex numeri fixum n {
        nota n
    }
}

Expected output:

1
2
3
4