Hi,
Am 20.01.2010 um 14:02 schrieb Jacek Generowicz:
> In Clojure 1.1.0, the documentation states:
>
> clojure.core/defmulti
> ([name docstring? attr-map? dispatch-fn & options])
> Macro
> Creates a new multimethod with the associated dispatch function.
> The docstring and attribute-map are optional.
>
> Options are key-value pairs and may be one of:
> :default the default dispatch value, defaults to :default
> :hierarchy the isa? hierarchy to use for dispatching
> defaults to the global hierarchy
>
> What is the purpose of the attribute map (and, perhaps more
> importantly, where could I have found an explanation in the
> documentation) ?
You can eg. add information about argument lists or other meta data.
(defmulti foo
"foo does bar with baz and frob."
{:arglists '([baz] [baz frob])}
(fn [& args] (vec (map type args))))
Try to define one multimethod with such an arglists definition and one without.
Then invoke doc on both and see the difference.
Sincerely
Meikel
--
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