sub function:

If the first argument is a list, creates a new list that start from the second arguments and has the size of the third argument. If the first argument is an object, creates a new object that start from the second arguments and has the size of the third argument. If the first argument is a string, creates a substring that start from the second arguments and has the size of the third argument.

Examples:

  • running: (sub [1, 2, 3, 4, 5, 6], 2, 3) will give: [3, 4, 5]

  • running: (sub [1, 2, 3, 4], 6, 10) will give: []

  • running: (sub [1, 2, 3, 4], 0, 10) will give: [1, 2, 3, 4]

  • running: (sub [1, 2, 3, 4], 1, 10) will give: [2, 3, 4]

  • running: (sub {"key-1": 1, "key-2": 2, "key-3": 3, "key-4": 4, "key-5": 5, "key-6": 6}, 1, 2) will give: {"key-2": 2, "key-3": 3}

  • running: (sub {"key-1": 1, "key-2": 2, "key-3": 3, "key-4": 4, "key-5": 5, "key-6": 6}, 0, 2) will give: {"key-1": 1, "key-2": 2}

  • running: (sub {"key-1": 1, "key-2": 2, "key-3": 3, "key-4": 4, "key-5": 5, "key-6": 6}, 4, 10) will give: {"key-5": 5, "key-6": 6}

  • running: (sub {"key-1": 1, "key-2": 2, "key-3": 3, "key-4": 4, "key-5": 5, "key-6": 6}, 20, 10) will give: {}

  • running: (sub "123456", 1, 3) will give: "234"

  • running: (sub "123456", 1, 30) will give: "23456"

  • running: (sub "123456", 0, 30) will give: "123456"

  • running: (sub "123456", 20, 30) will give: ""

  • running: (sub "123456", 2, 0) will give: ""

  • running: (sub 50, 0, 10) will return nothing

  • running: (sub "123", false, 10) will return nothing

  • running: (sub "123", 10, {}) will return nothing