Skip to main content

List Insert

Category: Lists List Insert block screenshot

Inserts one value into an existing list variable. Use `where` to insert at the `END`, at the `START`, before a zero-based `INDEX`, or before a zero-based `FROM_END` position. If `where` is omitted, the block defaults to `END`. The `index` input is only used for `INDEX` and `FROM_END`. Out-of-range indices throw an error, and `FROM_END` cannot be used on an empty list.

Inputs

InputRequiredValue KindTypesEnum Values
nameyesstring
valueyesexpression
wherenoexpressionenum-stringEND, START, INDEX, FROM_END
indexnoexpressionnumber

Notes

  • Mutating statement for inserting one value into a list variable.
  • where modes:
    • END: append to the end.
    • START: prepend at the start.
    • INDEX: insert before zero-based index from start; index may be equal to list length.
    • FROM_END: insert before the element at zero-based position from end (index=0 means before last element).
  • If where is omitted, behavior defaults to END.
  • index is only used for INDEX and FROM_END.
  • listPush remains available as a convenience alias for listInsert(where=END).

Examples

Traverse Nested Sequences With Deduped Worklist

Traverses the active sequence and nested sequences through a pending/seen worklist so nested sequence refs are not processed twice.

kind: Pattern · format: runtime-dsl · validation: MCP fixture

Topics: sequence traversal, nested sequences, clip iteration, lists

Source: patterns/ex-sequence-traverse-nested-deduped.json

Download JSON