No, I'm thinking more like: (defmacro errorable [success-spec error-spec] `(s/or :success ~success-spec :error ~error-spec))
(s/def ::result (errorable string? #{:authentication-failure :missing-input}) (s/conform ::result "Here is a successful and valid result.") -> [:success "Here is a successful and valid result."] (s/conform ::result :missing-input) -> [:error :missing-input] Now we have a standard spec for something that is either in success or in error. And it conforms to standard representations, a vector pair, with first being either the :success keyword or the :error keyword. You can add convenience function to this if you want, like: (defmacro if-error [spec value do-when-success do-when-error] ...) (if-error ::result result (display result) (display "An error occurred, please try again.") -- 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.