File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3434 ; ; currently we just incur a 0.5*number of types dropped penalty
3535 (+ cost (* 0.5 (- (count xs) (count combo)))))))))
3636
37+ (def ^:dynamic *fail-on-duplicate-conversion?* true )
38+
3739(defn conversion!
3840 ([from to f] (conversion! from to f 1 ))
3941 ([from-type-vec to-type-vec f cost]
4345 (swap! graph
4446 (fn [g]
4547 (if-let [existing (g/get-conversion g from to)]
46- (throw (ex-info (format " Conversion %s -> %s already exists: %s!" from to existing)
47- {:from from, :to to, :existing existing}))
48+ (when *fail-on-duplicate-conversion?*
49+ (throw (ex-info (format " Conversion %s -> %s already exists: %s!" from to existing)
50+ {:from from, :to to, :existing existing})))
4851 (let [f (wrap-validation from to f)]
4952 (g/assoc-conversion g from to f cost)))))))))
5053
You can’t perform that action at this time.
0 commit comments