{
    "$meta": {
        "description": "Create a `list` with square brackets. Then iterate over the `list` with for, or pull out individual items with a 0-based index in square brackets. A negative index counts from the end. Get a slice (subset) of a `list` with two indices, separated by a colon.",
        "example": [
            "x = [2, 4, 6, 8]",
            "print(x[0]) // get first item from list",
            "print(x[-1]) // get last item from list",
            "print(x[1:3]) // slice items from index 1 to 3",
            "x[2] = 5 // set item at index 2 to 5",
            "print(x)",
            "print(x + [42]) // concatenate two lists"
        ]
    },
    "remove": {
        "description": "Removes an item from the `list` with the provided index. Due to the removal the `list` will get mutated. If the passed index is `null` this method will throw an error preventing further script execution.",
        "example": [
            "myList = [1, 42, 3]",
            "myList.remove(1)",
            "print(\"This list does not contain the answer to everything: \" + myList.join(\", \"))"
        ]
    },
    "insert": {
        "description": "Inserts a value into the `list` at the index provided. Due to the insertion the `list` will get mutated. Returns the mutated `list`. If the passed index is not a `number`, this method throws an error, preventing further script execution.",
        "example": [
            "myList = [1, 3]",
            "myList.insert(1, 42)",
            "print(\"This list does contain the answer to everything: \" + myList.join(\", \"))"
        ]
    },
    "push": {
        "description": "Appends a value to the end of the `list`. This operation will mutate the `list`. Additionally, this method will return the updated `list`. However, it throws an error if you attempt to push a value into itself or into a map-like object such as a `file`, halting further script execution.",
        "example": [
            "myList = [1, 3]",
            "myList.push(42)",
            "print(\"This list does contain the answer to everything: \" + myList.join(\", \"))"
        ]
    },
    "pop": {
        "description": "Returns and removes the last item in the `list`. This operation will mutate the `list`. If the `map` is empty, this method will return `null`.",
        "example": [
            "myList = [1, 3, 42]",
            "answer = myList.pop",
            "print(\"Answer to everything: \" + answer)"
        ]
    },
    "pull": {
        "description": "Returns and removes the first item in the `list`.  This operation will mutate the `list`. If the `map` is empty, this method will return `null`.",
        "example": [
            "myList = [42, 1, 3]",
            "answer = myList.pull",
            "print(\"Answer to everything: \" + answer)"
        ]
    },
    "shuffle": {
        "description": "Shuffles all values in the `list`. This operation will mutate the `list`.",
        "example": [
            "myList = [42, 1, 3]",
            "myList.shuffle",
            "print(\"New list order: \" + myList.join(\", \"))"
        ]
    },
    "reverse": {
        "description": "Reverses the order of all values in the `list`. This operation will mutate the `list`.",
        "example": [
            "myList = [42, 1, 3]",
            "myList.reverse",
            "print(\"Reversed list: \" + myList.join(\", \"))"
        ]
    },
    "sum": {
        "description": "Returns sum of all values inside the `list`. Any non-numeric values will be considered a zero.",
        "example": [
            "myList = [42, 1, 3]",
            "sum = myList.sum",
            "print(\"Sum of all items in list: \" + sum)"
        ]
    },
    "hasIndex": {
        "description": "Returns a `number`. If the provided index is available in the `list`, the value will be one. Otherwise, the value will be zero.",
        "example": [
            "myList = [42, 1, 3]",
            "containsIndex = myList.hasIndex(1)",
            "if containsIndex then",
            "   print(\"List contains index of 1.\")",
            "else",
            "   print(\"List does not contain index of 1.\")",
            "end if"
        ]
    },
    "indexOf": {
        "description": "Returns a `number` which indicates the first matching index of the provided value inside the `list`. Optionally a start index can be provided. In case the value does not exist inside the `list` a `null` gets returned.",
        "example": [
            "myList = [42, 1, 3]",
            "index = myList.indexOf(42)",
            "if index != null then",
            "   print(\"The answer for everything is at the following index: \" + index)",
            "else",
            "   print(\"No answer for everything found.\")",
            "end if"
        ]
    },
    "sort": {
        "description": "Sorts the values of a `list` alphanumerically. This operation mutates the original `list`. Optionally, a key can be provided, which is used if the items are `map`s or `list`s. Finally, this method returns the updated `list`.",
        "example": [
            "myList = [{ \"key\": 42 }, { \"key\": 2 }, { \"key\": 1 }]",
            "myList.sort(\"key\")",
            "print(myList)"
        ]
    },
    "join": {
        "description": "Returns a concatenated `string` containing all stringified values inside the `list`. These values will be separated via the provided separator. In case the `list` exceeds `16777215L` items or the delimiter exceeds 128 characters, this method will throw an error, interrupting further script execution.",
        "example": [
            "myList = [42, 1, 3]",
            "print(myList.join(\" .-*'*-. \"))"
        ]
    },
    "indexes": {
        "description": "Returns a `list` containing all available indexes.",
        "example": [
            "myList = [42, 1, 3]",
            "for i in myList.indexes",
            "   print(myList[i])",
            "end for"
        ]
    },
    "len": {
        "description": "Returns a `number` representing the count of values inside the `list`.",
        "example": [
            "myList = [42, 1, 3]",
            "print(\"myList contains \" + myList.len + \" items\")"
        ]
    },
    "values": {
        "description": "Returns a `list` containing all available values. Note that this will not create a copy of the original `list`. The returned instance will the same as original `list`, so any mutations made to the returned `list` will also affect the original one.",
        "example": [
            "myList = [42, 1, 3]",
            "for v in myList.values",
            "   print(v)",
            "end for"
        ]
    },
    "replace": {
        "description": "Returns updated `list` where each value matching with the provided replace argument gets replaced. This operation will mutate the `list`.",
        "example": [
            "myList = [1, 2, 2, 7]",
            "myList.replace(2, 3)",
            "print(myList.join(\"\"))"
        ]
    }
}
