(rsubseq sc test key) (rsubseq sc start-test start-key end-test end-key)
sc must be a sorted collection, test(s) one of <, <=, > or >=. Returns a reverse seq of those entries with keys ek for which (test (.. sc comparator (compare ek key)) 0) is true
user> (rsubseq (sorted-set 1 2 3 4 5) < 3)
(2 1)
;; If you use the longer form, with the end condition, there are some rules.
;; start-key should be <= end-key. start-test should be ">" or ">=".
;; end-test should be "<" or "<=". If follow these rules you'll get all the
;; values between start-key and end-key. If you don't you won't get an error,
;; but you probably won't get the result you expect. These rules are exactly
;; the same for subseq.
;; As expected, returns everything between 2 and 4, in reverse order.
user=> (rsubseq (sorted-set 1 2 3 4 5) >= 2 <= 4)
;; => (4 3 2)
;; Probably not what you expected!
user=> (rsubseq (sorted-set 1 2 3 4 5) <= 4 >= 2)
;; => (2 1)
;; As expected, returns everything between 2 and 4, in order.
user=> (subseq (sorted-set 1 2 3 4 5) >= 2 <= 4)
;; => (2 3 4)
;; Probably not what you expected!
user=> (subseq (sorted-set 1 2 3 4 5) <= 4 >= 2)
;; => (4 5)