API Reference › List › List.insert
method

List.insert

List.insert(s, i, v) -> void

Inserts v at index i, moving the elements at and after i one place toward the end and growing the backing buffer if needed. Use it to keep a list ordered as you build it, or to splice an item into the middle. Appending is cheaper with List.push.

Example

program Demo {
  handler Step phase Update {
    List.insert(queue, 0, next_id)   # push to the front
  }
}
← All symbols