Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "#'symbol" notation mean in clojure?

Tags:

clojure

I'm learning clojure on Heroku using this tutorial. I've come across the same thing in other tutorials, as well.

Anyway, using the jetty adapter in ring, you have something like this:

(defroutes routes 
  ...)

(defn start []
  (ring/run-jetty #'routes {:port 8080 :join? false}))

I don't understand what #'routes means. If I replace it with just routes it seems to work fine. What does the #'symbol notation mean? It's been very difficult to research.

like image 503
tjb1982 Avatar asked Sep 09 '25 19:09

tjb1982


1 Answers

It's a reader macro. #'foo expands to (var foo). See Is pound-quote (hash-quote, #') in Clojure running the resolve and symbol functions?, Difference between Symbols and Vars in Clojure and http://clojure.org/vars where you can find in-depth discussion.

like image 94
Jan Avatar answered Sep 13 '25 13:09

Jan