in Rich Hickeys ant game, he has the following code:
(import
'(java.awt Color Graphics Dimension)
'(java.awt.image BufferedImage)
'(javax.swing JPanel JFrame))
(defn fill-cell [#^Graphics g x y c]
(doto g
(.setColor c)
(.fillRect (* x scale) (* y scale) scale scale)))
I can’t find documentation anywhere for what #^ means in this context, any help appreciated.
The
#^is the old syntax for metadata reader macro. The syntax has changed to^in clojure 1.2. See http://clojure.org/reader. In your example,#^Graphicsrepresents a type hint which is used for performance reasons.