• (defhinted sym init)
Defines a var with a type hint matching the class of the given
init. Be careful about using any form of 'def' or 'binding' to a
value of a different type. See http://paste.lisp.org/display/73344

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/def.clj:85 top

(defmacro defhinted
  "Defines a var with a type hint matching the class of the given
  init.  Be careful about using any form of 'def' or 'binding' to a
  value of a different type.  See http://paste.lisp.org/display/73344"
  [sym init]
  `(do
     (def ~sym ~init)
     (alter-meta! (var ~sym) assoc :tag (class ~sym))
     (var ~sym)))
Vars in clojure.contrib.def/defhinted: defmacro alter-meta! assoc class concat list seq
Used in 0 other vars

Comments top

No comments for defhinted. Log in to add a comment.