Created
October 21, 2013 08:59
-
-
Save llasram/7080761 to your computer and use it in GitHub Desktop.
LensKit precalculation dependency-injection structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns ... | |
(:import [clojure.lang IDeref] | |
...) | |
(definterface UUPrecalc) | |
(defprovider uu-precalc | |
^UUPrecalc [^UserDAO udao, ^UserEventDAO uedao] | |
(let [data ...] | |
(reify UUPrecalc IDeref (deref [_] data)))) | |
... | |
(defprovider suu-item-scorer | |
^ItemScorer [^UserEventDAO udao, ^ItemEventDAO idao, ^UUPrecalc precalc] | |
;; Use @precalc | |
...) | |
... | |
(defn configure-recommender | |
... | |
(-> (.bind UUPrecalc) (.toProvider uu-precalc)) | |
...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment