Multimethods on records and integers

I’d say your overall description doesn’t sound very idiomatic for Clojure. Where we tend to prefer using data directly, instead of wrapping things in custom data types.

But, since I don’t know the context of this Bdd, I can’t really speak too if in your case it really is the right approach or not. I would recommend reading this: https://clojure.org/about/state to get a feel for it.

  1. You can extend print-method
  2. You would just make use of the type fn inside your dispatch fn for each arguments.
  3. You can have hierarchies on multi-methods, see here: https://clojure.org/reference/multimethods .
  4. For that, you will want to use deftype. Read up on deftype and defprotocols here: https://clojure.org/reference/datatypes
  5. You can just use that same jboss map.
1 Like