Erase¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
Any input is ignored. | Any |
||
<output> |
The input to this shard is passed through as its output. | Any |
||
Indices |
One or multiple indices to filter from a sequence. | None |
Int [Int] &Int &[Int] String [String] &String &[String] |
|
Name |
The name of the variable. | "" |
String &Any |
|
Key |
The key of the value to read/write from/in the table (this variable will become a table). | None |
String |
|
Global |
If the variable is or should be available to all of the wires in the same mesh. | false |
Bool |
Deletes identified element(s) from a sequence or key-value pair(s) from a table.
Details¶
Erase
deletes single or multiple elements (from sequences) and key-value pairs (from tables).
For a sequence, this shard expects the index (or a sequence of indices in descending order) of the element(s) to be erased, followed by the name of the sequence variable in the :Name
parameter.
For a table, this shard expects the key (or a sequence of keys) of the key-value pair(s) to be erased, followed by the name of the table variable in the :Name
parameter.
This shard works on both sequences and tables. Parameter :Key
applies only to tables.
Since variables may be locally scoped (created with (:Global false)
; exists only for current wire) or globally scoped (created with (:Global true)
; exists for all wires of that mesh), both parameters :Global
and :Name
are used in combination to identify the correct variable to erase.
Any input to this shard is ignored and instead passed through as its output.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
[info] Set - Warning: setting an already exposed variable "seq", use Update to avoid this warning.
[info] Set - Warning: setting an already exposed variable "tab", use Update to avoid this warning.
[info] [shards/General/Erase/Erase.edn] output: [100 300 400 200]
[info] [shards/General/Erase/Erase.edn] .seq1: [100 300 400]
[info] [shards/General/Erase/Erase.edn] [200 400]
[info] [shards/General/Erase/Erase.edn] {k1: 10 k3: 30}
[info] [shards/General/Erase/Erase.edn] {k2: 200}
[info] [shards/General/Erase/Erase.edn] [2]
[info] [shards/General/Erase/Erase.edn] [1 3]
[info] [shards/General/Erase/Erase.edn] {k2: 2}
[info] [shards/General/Erase/Erase.edn] {k1: 1 k3: 3}