cfunction
src/core/tuple.c on line 66, column 1
(tuple/slice ind &opt start end)
Returns a tuple based on a range of an indexed type `ind`. The
range is specified by optional index arguments `start` and `end`
defaulting to 0 and the length of `ind` respectively. When
non-negative, `start` is inclusive and `end` is exclusive, i.e.
[`start`, `end`), and their values can range from 0 through the
length of `ind`. When negative, `start` is exclusive and `end` is
inclusive, i.e. (`start`, `end`], and their values can range from
the negative of one more than the length of `ind` through -1. If
`start` or `end` is out of range, an error is raised.
(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 ) # => ()