beginners

Kimo 2025-11-30T20:41:05.412469Z

Spec question - say I have a fn signature like this: (defn foo [a b & {:keys [c d]}]). So a and b should be integers and c and d should be strings. But of course, c and d are optional, and the callsite can have two forms: either (foo a b :c "bar" :d "baz") or (foo a b {:c "bar" :d "baz"}). How can I write the :args part of (fdef foo :args ...) ?

Alex Miller (Clojure team) 2025-11-30T20:50:26.786809Z

yes

Alex Miller (Clojure team) 2025-11-30T20:51:09.144399Z

there's an example in https://clojure.org/guides/spec with keys* if that's helpful

👀 1
Alex Miller (Clojure team) 2025-11-30T20:51:33.159949Z

keys* handles the trailing map stuff for you

Kimo 2025-11-30T20:51:55.211959Z

cool, thanks