1.2.0 permalink Arrow_down_16x16
  • (defn-memo fn-name & defn-stuff)
Just like defn, but memoizes the function using clojure.core/memoize

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:143 top

(defmacro defn-memo
  "Just like defn, but memoizes the function using clojure.core/memoize"
  [fn-name & defn-stuff]
  `(do
     (defn ~fn-name ~@defn-stuff)
     (alter-var-root (var ~fn-name) memoize)
     (var ~fn-name)))
Vars in clojure.contrib.def/defn-memo: defmacro alter-var-root concat defn list memoize seq
Used in 0 other vars

Comments top

No comments for defn-memo. Log in to add a comment.