Make your functions cached.
[net.snca/cachify "0.0.1"]
(require '[cachify.core :refer :all])
(def plus (cachify :plus (fn [a b]
(println a "+" b)
(+ a b))))
(defcachify minus
[a b]
(println a "-" b)
(- a b))
(defn -main []
(println (plus 1 2)) ; → 1 + 2
; 3
(println (plus 1 2)) ; → 3
(println (minus 1 2)) ; → 1 - 2
; -1
(println (minus 1 2)) ; → -1
(perm) ; Write all caches to files
)
Copyright © 2020 anekos
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close