> > (defn substring? [str1 str2] > (let [c1 (count str1) > c2 (count str2)] > (and (<= c1 c2) > (or (= str1 (subs str2 0 c1)) > (substring? str1 > (subs str2 1 c2))))))
This should be a little faster: (defn substring? [#^String s1 #^String s2] (not (= -1 (.indexOf s2 s1)))) user=> (substring? "foo" "foobar") true user=> (substring? "bar" "Baz") false --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---