Last active
August 29, 2015 14:12
-
-
Save 0rca/0d91ee7e0953ad3fb7ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn numseq [] | |
(->> (range) (map inc) (map #(.toString %)) (map seq) (flatten))) | |
(defn positions-of [el s] | |
(let [el' (-> el .toString seq)] | |
(->> s | |
(partition (count el') 1) | |
(map-indexed vector) | |
(filter (fn [[i x]] (= x el'))) | |
(map (comp inc first))))) | |
(defn find-first [el s] | |
(first (positions-of el s))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment