Skip to content

Instantly share code, notes, and snippets.

@skatenerd
Created February 22, 2014 23:23
Show Gist options
  • Save skatenerd/9163965 to your computer and use it in GitHub Desktop.
Save skatenerd/9163965 to your computer and use it in GitHub Desktop.
"Referential Transparency". Yep. Totally transparent.
(def kill-spaces #(clojure.string/replace % " " ""))
(-> "a b c" kill-spaces)
;"abc"
(-> "a b c" #(clojure.string/replace % " " ""))
;kaboom!!!!!
@trptcolin
Copy link

user=> (macroexpand-1 '(-> "a b c" kill-spaces))
(kill-spaces "a b c")

user=> (macroexpand-1 '(-> "a b c" #(clojure.string/replace % " " "")))
(fn* "a b c" [p1__729#] (clojure.string/replace p1__729# " " ""))

user=> (read-string "#(clojure.string/replace % \" \" \"\")")
(fn* [p1__741#] (clojure.string/replace p1__741# " " ""))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment