This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-11
Channels
- # announcements (14)
- # beginners (119)
- # boot (9)
- # calva (7)
- # cider (12)
- # cljdoc (2)
- # cljsrn (28)
- # clojure (127)
- # clojure-dev (2)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-losangeles (9)
- # clojure-nl (6)
- # clojure-spec (15)
- # clojure-uk (39)
- # clojurescript (35)
- # community-development (4)
- # cursive (9)
- # datascript (8)
- # datomic (5)
- # duct (3)
- # emacs (10)
- # fulcro (45)
- # graphql (3)
- # jobs (1)
- # kaocha (8)
- # luminus (2)
- # off-topic (121)
- # onyx (3)
- # pathom (15)
- # pedestal (31)
- # planck (5)
- # reagent (25)
- # reitit (3)
- # remote-jobs (1)
- # shadow-cljs (48)
- # slack-help (1)
- # sql (142)
- # tools-deps (78)
Is there something like (describe-spec :my/spec)
that will print what :my/spec
is about? Maybe recursively.
Loosely analog to macroexpand
/`macroexpand-all`
it is, however, not deep/recursive
(doc :my/spec)
Hi all, can someone help me with spec’ing a higher-order fn? One of the arguments to a fdef
is a higher order fn that I’ve defined as:
(s/def ::foo-fn (s/fspec :args any? :ret ::foo))
This works except running something like test.check
on the fn that takes foo-fn
as an arg is super slow. …If I just pass ::foo
in instead of ::foo-fn
everything generates as quickly as usual so I’m guessing I’m doing something wrong… 😞 . Any thoughts? thx!!
…oh… and ::foo has no args but not sure how to express that.. :args nil
doesn’t work:args (s/cat)
is prob best
fspecs are instrumented by generating args and invoking the passed function a bunch of times
this is sometimes surprising and/or bad for people
an alternate option to using an s/fspec
here is to just spec it as ifn?
@alexmiller Will try those out! Thanks!!
…Using :args (s/cat)
instead of any?
definitely sped things up.. Can’t use ifn?
for my specific use case but still generating / running through my system about 5 results per second which is pretty fast. …just spoiled by how fast test.check
usually runs data!
any?
can generate very large nested colls
(s/cat)
can only generate one thing, ()