JanetDocsPlaygroundI'm feeling luckyGitHub sign in

array/remove



    cfunction
    src/core/array.c on line 294, column 1

    (array/remove arr at &opt n)

    Remove up to `n` elements starting at index `at` in array `arr`. 
    `at` can index from the end of the array with a negative index, and 
    `n` must be a non-negative integer. By default, `n` is 1. Returns 
    the array.


1 exampleSign in to add an example
Loading...
# janet 1.10.1

(array/remove @[1 2 3] 0)  # => @[2 3]
(array/remove @[1 2 3] 1)  # => @[1 3]
(array/remove @[1 2 3] 2)  # => @[1 2]
(array/remove @[1 2 3] 3)  # => @[1 2 3]
(array/remove @[1 2 3] 4)  # error: index out of range

(array/remove @[1 2 3] -1)  # => @[1 2 3]
(array/remove @[1 2 3] -2)  # => @[1 2]
(array/remove @[1 2 3] -3)  # => @[1 3]
(array/remove @[1 2 3] -4)  # => @[2 3]
(array/remove @[1 2 3] -5)  # error: index out of range

(array/remove @[1 2 3 4] 1 1)   # => @[1 3 4]
(array/remove @[1 2 3 4] 1 2)   # => @[1 4]
(array/remove @[1 2 3 4] 1 3)   # => @[1]
(array/remove @[1 2 3 4] 1 4)   # => @[1]
(array/remove @[1 2 3 4] 1 99)  # => @[1]
cellularmitosisPlayground