Skip to content

Instantly share code, notes, and snippets.

@matheusazzi
Created November 13, 2017 23:25
Show Gist options
  • Save matheusazzi/eb53bcdd760b7ce78e506460c39a0f86 to your computer and use it in GitHub Desktop.
Save matheusazzi/eb53bcdd760b7ce78e506460c39a0f86 to your computer and use it in GitHub Desktop.
example.clj
(def tags ["1.0.0" "1.0.1" "1.0.2" "1.1.0" "1.1.2" "1.2.2"])
(defn remove-dots [tag]
(clojure.string/replace tag "." ""))
(defn to-int [s]
(Integer/parseInt s))
(defn between-versions? [n]
(and (> n 101) (< n 120)))
(->> tags
(map remove-dots)
(map to-int)
(filter between-versions?))
; or
; (->> tags
; (map (comp to-int remove-dots))
; (filter between-versions?))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment