basilisp-lang / basilisp

A Clojure-compatible(-ish) Lisp dialect targeting Python 3.8+
https://basilisp.readthedocs.io
Eclipse Public License 1.0
198 stars 4 forks source link

defmulti support for optional meta attribute map arg #857

Closed ikappaki closed 4 months ago

ikappaki commented 5 months ago

defmulti does not support an optional metadata arg (attr-map?) as in Clojure

    (defmulti name docstring? attr-map? dispatch-fn & options)

For example, in basilisp

basilisp.user=> (defmulti xyz {:a 1} :tag)
Traceback (most recent call last):
...
    entries = pymap(lambda v: MapEntry.of(v[0], v[1]), partition(pairs, 2))
                                                ~^^^
IndexError: tuple index out of range

while in Clojure

user> (defmulti xyz {:a 1} :tag)
#'user/xyz
user> (meta #'xyz)
{:a 1,
;; ...
 :name xyz,
 :ns #namespace[user]}

PR to follow.