> > multi-spec doesn't require you to use a key of a map - it's an arbitrary > function on arbitrary data, so it could leverage satisfies? or other > protocol functionality. >
Oh, that's good to know, but I'm talking other way around. Where I can dispatch based on what the spec is for a given data-structure. Like if I could do this: (defprotocol Bar (bar [this])) (s/def ::name string?) (s/def ::id int?) (s/def ::person (s/keys :req [::name])) (s/def ::item (s/keys :req [::id])) (extend ::person Bar {:bar (fn [this] (::name this))}) (extend ::item Bar {:bar (fn [this] (::id this))}) (bar {::name "John Doe"}) (bar {::id 1234}) On Wednesday, 29 March 2017 13:15:06 UTC-7, Alex Miller wrote: > > multi-spec doesn't require you to use a key of a map - it's an arbitrary > function on arbitrary data, so it could leverage satisfies? or other > protocol functionality. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.