cfunction
src/core/tuple.c on line 66, column 1
(tuple/slice arrtup [,start=0 [,end=(length arrtup)]])
Take a sub-sequence of an array or tuple from index `start`
inclusive to index `end` exclusive. If `start` or `end` are not
provided, they default to 0 and the length of `arrtup`,
respectively. `start` and `end` can also be negative to indicate
indexing from the end of the input. Note that if `start` is
negative it is exclusive, and if `end` is negative it is inclusive,
to allow a full negative slice range. Returns the new tuple.
(tuple/slice [:a :b :c :d]) # => (:a :b :c :d)
(tuple/slice [:a :b :c :d] 0) # => (:a :b :c :d)
(tuple/slice [:a :b :c :d] 1) # => (:b :c :d)
(tuple/slice [:a :b :c :d] 3) # => (:d)
(tuple/slice [:a :b :c :d] 4) # => ()
(tuple/slice [:a :b :c :d] 5) # error: index out of range
(tuple/slice [:a :b :c :d] -1) # => ()
(tuple/slice [:a :b :c :d] -2) # => (:d)
(tuple/slice [:a :b :c :d] -4) # => (:b :c :d)
(tuple/slice [:a :b :c :d] -5) # => (:a :b :c :d)
(tuple/slice [:a :b :c :d] -6) # error: index out of range
(tuple/slice [:a :b :c :d] 0 0) # => ()
(tuple/slice [:a :b :c :d] 0 1) # => (:a)
(tuple/slice [:a :b :c :d] 0 4) # => (:a :b :c :d)
(tuple/slice [:a :b :c :d] -1 -1) # => ()
(tuple/slice [:a :b :c :d] -2 -1) # => (:d)
(tuple/slice [:a :b :c :d] -5 -1) # => (:a :b :c :d)
(tuple/slice [:a :b :c :d] 1 0) # => ()
(tuple/slice [:a :b :c :d] 4 0) # => ()
(tuple/slice [:a :b :c :d] -1 -2) # => ()
(tuple/slice [:a :b :c :d] -1 -5) # => ()