Public Vars

Back

prefers (clj)

(source)

function

(prefers multifn)
Given a multimethod, returns a map of preferred value -> set of other values

Examples

camsaul/methodical
(ns methodical.impl.dispatcher.everything
  (:refer-clojure :exclude [methods])
  (:require
   [clojure.core.protocols :as clojure.protocols]
   [methodical.impl.dispatcher.common :as dispatcher.common]
   [methodical.interface :as i]
   [methodical.util.describe :as describe]
   [pretty.core :as pretty])
  (:import
   (methodical.interface Dispatcher)))

(deftype EverythingDispatcher [hierarchy-var prefs]
  pretty/PrettyPrintable
  (pretty [_]
    (cons
     'everything-dispatcher
     (concat
      (when (not= hierarchy-var #'clojure.core/global-hierarchy)
        [:hierarchy hierarchy-var])
      (when (seq prefs)
        [:prefers prefs]))))

  (prefers [_]
    prefs)

  (with-prefers [_this new-prefs]
    (EverythingDispatcher. hierarchy-var new-prefs))