Fork me on GitHub
#clojure-spec
<
2017-04-04
>
tjtolton11:04:23

I said the same thing to him once. His response was "It's literally my job."

tjtolton16:04:27

Anyone know of a clean way to get the list of defined arguments for a function spec?

tjtolton16:04:11

basically I want to pull arguments out of a request body and pass them into a function based on that function's spec

tjtolton16:04:23

I'd bet a dollar somebody's done this before me

tjtolton16:04:32

Wow, this isn't as straightforward as I thought.

minimal17:04:41

@tjtolton does this help? (s/form (:args (s/get-spec `my-fun)))

minimal17:04:11

returns something looking like (clojure.spec/cat :a clojure.core/string? :id clojure.core/number?)

tjtolton17:04:18

you can just use keyword on a spec object like that?

tjtolton17:04:36

That's actually pretty awesome

Alex Miller (Clojure team)18:04:04

function specs implement ILookup for :args, :ret, and :fn