array (item itemCount -- array)
Inputs
item: Item object.itemCount: Known repeated-item count.
Outputs
array constructs a repeated-item List from one object and one known Int32 item count.
The builtin uses the dereferenced item, so an object and a Ref to that object produce the same repeated item value.
Behavior
- A negative item count is invalid.
- A zero item count produces the empty Tuple
(). - A positive item count produces a List with that many repeated items of the dereferenced item schema.
- A known In-place item produces repeated known items.
- An unknown In-place item produces a List of the same schema with unknown repeated contents.
- A Meta item produces a List of the same schema.
- The builtin requires a non-
NILitem object.
Example
{} () {} [
value: 7;
"-- dereferenced item --" printCompilerMessage
value 2 array printStack _:;
@value 2 array printStack _:;
"-- unknown item --" printCompilerMessage
0 dynamic 2 array printStack _:;
"-- meta item --" printCompilerMessage
() 3 array printStack _:;
"-- zero count --" printCompilerMessage
5 0 array printStack _:;
] "main" exportFunction
Expected Output During Compilation
-- dereferenced item --
(7 7)
(7 7)
-- unknown item --
Int32 2 array
-- meta item --
() 3 array
-- zero count --
()