Skip to content

Instantly share code, notes, and snippets.

@pbalduino
Last active August 29, 2015 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbalduino/f4594e02932380e94fa0 to your computer and use it in GitHub Desktop.
Save pbalduino/f4594e02932380e94fa0 to your computer and use it in GitHub Desktop.
-> e ->>
(defn minha-funcao [a b]
(println "a =" a "- b=" b))
(-> "valor"
(minha-funcao "outro"))
; a = valor - b= outro
(->> "valor"
(minha-funcao "outro"))
; a = outro - b= valor
;; quando você usa funções com apenas um argumento, tanto faz um quanto o outro,
;; e também tanto faz usar parênteses ou não
(defn apenas-um [x]
(str "x = " x)
x)
(-> "valor"
apenas-um)
; x = valor
(-> "valor"
(apenas-um))
; x = valor
(->> "valor"
apenas-um)
; x = valor
(->> "valor"
(apenas-um))
; x = valor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment