take it from thinking in "items in the array" to functions that take sequences and return sequences. This decomplexts the task of matching and deciding if what you matched solves your problem. (Im fairly sure that decomplect is ONLY in the Clojure dictionary)
in general:
- from the input data create a sequence that will contain what you are looking for:
autotestbed.core> (partition 3 1 (range 10))
((0 1 2) (1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 7) (6 7 8) (7 8 9))
- then from that sequence extract just the parts that fit your criteria:
(filter your-predicate-here (partition ...)
- then decide if your answer has been found:
(some true? ....)
in larger example some people would choose to devide this into several functions and then compose them.
To address your original question: (for thous whom google brings from the question title)
the subvec function returns subvectors in order-1 time
user>(subvec (vec (range 1000)) 10 20)
[10 11 12 13 14 15 16 17 18 19]