: I want to use multimethods to send and distribute functions in multiple files. one of the files contains only multimethods, and to make them usable, I have to manually upload the file. Is there a way to automatically upload a file, rather than explicitly upload it?
here is a simple example of what i am doing:
; app/core.clj
(ns app.core
(:use [app.fruit.core :only [make-fruit]])
(println (:name (make-fruit :banana)))
; app/fruit/core.clj
(ns app.fruit.core)
(defmulti make-fruit identity)
; app/fruit/banana.clj
(ns app.fruit.banana
(:use [app.fruit.core :only [make-fruit]])
(defmethod make-fruit :banana [fruit]
{:name "banana" :color "yellow})
The fruit.banana method does not load unless I explicitly load it into app.core, for example, adding it to the: use group. this seems to have surpassed the goal of using the multidimensional method, since I still have to be explicit in relation to all methods of its implementation.
source
share