Function: list.prepend

Creates a copy of a list with a new element added to the beginning.

Arguments

Arguments
objs

list

The source list. Note that this list is not modified.

val

any

The element that will be prepended to the beginning.

Returns

A copy of objs with val added to the beginning.

Raised exceptions

Exceptions
TypeError If objs is not a list.

Examples

# Prepend `val` to start of copy of `my_list`
# Returns `["three","zero","one","two"]`
- init:
    assign:
      - my_list: ["zero","one","two"]
      - val: "three"
- returnStep:
    return: ${list.prepend(my_list, val)}