Args
Argument pack.
Args values are returned by variadic captures such as ...rest and by
calling the Args type object. Iterating an Args value yields [key, value]
pairs. Positional items use their positional index as the key.
Constructor
Args ...
Creates an argument pack from positional and keyed arguments.
Fields
len
Number of items in the argument pack.
Methods
push ...
Appends positional and keyed arguments to the pack.
Returns: nil
let pack = args 1
pack.push 2 name: Alice
let items = [...pack]
assert_eq $items[1][1] 2
assert_eq $items[2][0] :name:
pos_only
Returns an iterator over positional values.
Raises UnexpectedKeyError if the pack contains
any keyed items.
let pack = args 1 2 3
let pos = pack.pos_only()
assert_eq [...pos] [1, 2, 3]
assert_eq [...pack] [[0, 1], [1, 2], [2, 3]]
pos_keys
Returns a tuple of positional values and keyed entries.
The first item is an iterator over positional values. The second item is an
iterator over keyed [key, value] pairs.