I guess I could get rid of the multimethod and instead do something like
this:
((symbol (:intent this-users-conversation)))
but that seems like a hack.
On Wednesday, September 30, 2015 at 8:33:36 PM UTC-4, Lawrence Krubner
wrote:
>
> For maximum flexibility I wanted to use a multimethod, defined like this:
>
>
> (defmulti intent
> (fn [& args]
> (apply discern args)))
>
> This is how discern is defined:
>
> (defn- discern
>
> ([this-users-conversation]
> {:pre [(map? this-users-conversation)]}
> (:intent this-users-conversation))
>
> ([this-users-conversation salesforce-object-name]
> {:pre [(map? this-users-conversation)
> (string? salesforce-object-name)]}
> (:intent this-users-conversation))
>
> ([this-users-conversation salesforce-object-name name-of-attribute]
> {:pre [(map? this-users-conversation)
> (string? salesforce-object-name)
> (string? name-of-attribute)]}
> (:intent this-users-conversation))
>
> ([this-users-conversation salesforce-object-name name-of-attribute
> name-of-intent]
> {:pre [(map? this-users-conversation)
> (string? salesforce-object-name)
> (keyword? name-of-attribute)
> (string? name-of-intent)]}
> name-of-intent))
>
> but then I call the multimethod like this:
>
> (intent this-users-conversation "Opportunity" :Name
> "query-salesforce-for-attribute")
>
> and I get:
>
> :class clojure.lang.ArityException,
> :message "Wrong number of args (4) passed to: query/fn--65",
>
> Should I give up on this idea, or is there a way to make this work?
>
>
>
>
>
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.