Ahh, thanks a lot. Was confused that valid? worked fine, but didn't know about args being a sequence
Den fredag den 10. juni 2016 kl. 15.19.48 UTC+2 skrev Alex Miller: > > You want: > > (s/fdef command > :args (s/cat :m (s/keys :req [::test]) > :ret string?) > > :args takes a sequence of the arguments as if you were going to apply it. > > On Friday, June 10, 2016 at 7:58:10 AM UTC-5, Steen Larsen wrote: >> >> Hi, >> >> I am playing around with spec, and really like it so far, but have a >> problem using fdef with maps. I am obviously missing something trivial, but >> the following example gives a, to me, weird error >> >> (defn command [m] >> "hello") >> >> (s/def ::test integer?) >> >> (s/fdef command >> :args (s/keys :req [::test]) >> :ret string?) >> >> Running >> >> (command {:test 3}) >> >> gives >> >> Call to #'cqrs-spec.core/command did not conform to spec: val: >> ({:test 3}) fails at: [:args] predicate: map? :clojure.spec/args >> ({:test 3}) >> >> {:clojure.spec/problems >> {[:args] {:pred map?, :val ({:test 3}), :via [], :in []}}, >> :clojure.spec/args ({:test 3})} >> >> which seems to say that the function receives a list and not a map, even >> though it obviously does. Now why is that ? >> >> /Steen >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.