Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn- seq-index-of
- "If ys is a subsquence of xs, return the index of where it occurs, nil
- otherwise."
- [xs ys]
- (let [slv? (some-fn seq? list? vector?)]
- (when (and (slv? xs) (slv? ys))
- (let [idx (.indexOf xs (first ys))]
- (when (and ((complement neg?) idx)
- (= ys (take (count ys) (drop idx xs))))
- idx)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement