The answer to your subject line question is: no, s/and applies the first
predicate and flows the conformed value (if valid) through any remaining
predicates – regardless of where it is used. There’s nothing special about its
use inside s/fdef. Per the s/and docstring (emphasis added):
sorry, I edited this a few times and bumbled the words. That last sentence
should say: I can think of different ways to do it, but I don't think any
of them are better. However I feel the example used above [...]
On Friday, August 11, 2017 at 1:06:39 PM UTC-7, scott stackelhouse wrote:
>
> I
I have to say I find this confusing:
"First the :args is a compound spec that describes the function arguments.
This spec is invoked with the args in a list, as if they were passed to (apply
fn (arg-list)). Because the args are sequential and the args are positional
fields, they are almost
> However this doesn't produce good results if your JSON contains a key you
> haven't listed in fields –
> so you'd probably have to write an actual function to do the mapping.
(def my-ns *ns*) ; bind at compile time
;; or use a constant string for the ns if you want
(defn fields [k] (keyword
core.specs.alpha is a Clojure library containining specs to describe
Clojure core macros and functions.
core.specs.alpha 0.1.24 is now available. core.specs.alpha is included
automatically as a dependency of Clojure in the 1.9 alphas, but you can
also hard code this to pull in a newer version