Advertisement
Guest User

dedup across files

a guest
Jun 22nd, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; one.clj
  2. (ns my.one)
  3. (my-atom (atom {}))
  4. (swap! my-atom assoc :id 1)
  5. (defn shorthand-get-id []
  6.   (:id @my-atom))
  7.  
  8. ;; two.clj
  9. (ns my.two)
  10. (my-atom (atom {}))
  11. (swap! my-atom assoc :id 2)
  12. (defn shorthand-get-id []
  13.   (:id @my-atom))
  14.  
  15. ;; core.clj
  16. (ns my.core
  17.   (:require [my.one :as one]
  18.             [my.two :as two]))
  19. ;; how to not rewrite "shorthand-get-id" in each of
  20. ;; one.clj and two.clj???
  21. (defn main []
  22.   (prn (str "one's id " (one/shorthand-get-id) ", "
  23.             "two's id " (two/shorthand-get-id))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement