Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. boot.user=> (defn and->> [f value] (doto value f))
  2. #'boot.user/and->>
  3. boot.user=> (defn and-> [value f] (doto value f))
  4. #'boot.user/and->
  5.  
  6. ;; use the appropriate and->(>) form for your threading macro
  7. boot.user=> (-> 1 (and-> println))
  8. 1
  9. 1
  10.  
  11. ;; or ignore the value passed in
  12. boot.user=> (->> 1 (and->> (fn [_] (println "hello"))))
  13. hello
  14. 1
  15. boot.user=> (-> 1 (and-> (fn [_] (println "hello"))))
  16. hello
  17. 1
  18.  
  19. ;; or perhaps using `constantly`?
  20. (-> 1 (and-> (constantly (println "hello")))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement