Search code examples
clojuresequences

Clojure sub-sequence position in sequence


Does Clojure provide any builtin way to find the position of a sub-sequence in a given sequence?


Solution

  • Clojure provides a builtin way for easy Java Interop.

    (java.util.Collections/indexOfSubList '(a b c 5 6 :foo g h) '(5 6 :foo))
    ;=> 3