repeatList
Canonical ID: collections.repeat. Nederlands: herhaalLijst.
Creates a fixed-length list filled with the requested value. Each repeated nested List or Map is independently cloned, which makes this suitable for grids. A count of zero returns an empty list. A fractional, negative, or excessive count is rejected. Repeating a value does not repeatedly evaluate the argument expression: arguments are evaluated once before the call.
Signature
repeatList(count, value)
Arguments
| Parameter | Type | Requirement |
|---|---|---|
count |
Number | Whole number from 0 through 100,000. |
value |
Any | Value to repeat; nested collections are cloned. |
Return value
List.
Example
# language: en
let board = repeatList(3, repeatList(4, 0))
set board[0][0] = 9
say board[0][0], board[1][0], length(board)
Prints 9 0 3; changing the first row does not change the second.
Notes and common mistakes
Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.
