This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-15
Channels
- # aws-lambda (3)
- # beginners (17)
- # boot (65)
- # cider (3)
- # cljs-dev (7)
- # cljsrn (82)
- # clojure (82)
- # clojure-italy (1)
- # clojure-russia (25)
- # clojure-spec (56)
- # clojure-uk (5)
- # clojurescript (52)
- # css (2)
- # datomic (6)
- # emacs (1)
- # hoplon (9)
- # jobs-discuss (5)
- # leiningen (8)
- # mount (2)
- # nginx (1)
- # off-topic (2)
- # om (1)
- # om-next (9)
- # perun (13)
- # portland-or (1)
- # re-frame (13)
- # reagent (20)
- # remote-jobs (2)
- # ring (5)
- # spacemacs (1)
- # specter (10)
- # untangled (5)
- # yada (6)
@rickmoynihan that’s a decent hint to programmers, but it’s not quite good enough semantics
Is there a way to drill into specs from REPL? Say, an output from (doc ns)
gives args: (cat :name simple-symbol? :docstring (? string?) :attr-map (? map?) :clauses :clojure.core.specs/ns-clauses)
, how do I see the definition of :clojure.core.specs/ns-clauses
spec?
some specs seem to resolve eagerly, some lazily - is there some way to force laziness for the sake of forward references?
> that’s a decent hint to programmers, but it’s not quite good enough semantics for example, a generator will produce arbitrary values there, @bbloom: What else could a generator do though? As far as I can see it can only explicitly fail or generate a likely incorrect value
i kinda also want to be able to test things w/ incomplete specs - like if i have (s/or :foo string? :bar some-crazy-thing?) i should at least be able to test the :foo path, even if :bar isn’t tested
bbloom: then maybe just use the generator (fn [] (throw (ex-info “Unspeced function”))
that solves the conform/instrument case (modulo fspec) but not quite the partial generator case - which i guess would require some changes to the generator monad thing? i dunno if it supports filtering
yeah - was just thinking you want them to flow
it seems you want something a little like a prolog cut
yeah might be the opposite of that 🙂
i haven’t looked too deeply at writing generators yet, so i don’t know what the monad thing is about - i imagine it’s like mfilter or something
its not something I’ve looked into
ie you had map x -> y, now you have map x -> [y] and then you can filter by doing map x -> []
MonadPlus provides the “zero” value, ie [] for the list monad or just an empty stream of generated data
I’m still trying to get my head around exactly what being a partial generator means… presumably it’s just something like (s/or :walk gen-me :don-walk unspecced-gen-ignore-me)
(semantically - rather than in practice)
why walk it? rather than ignore it?
gen/such-that
is the monad-plus part
but it's not really monad-plus since it will just give up if it can't get the pred to pass
@bbloom warn and skip just applies to s/or
specs?
that’s where it would be most useful, but i don’t see why it wouldn’t apply to any spec… for example:
sounds possible, sure
can’t a spec be included anywhere though? And anywhere you include an unspeced spec wouldn’t it imply the specs had to effectively be rewritten to use an s/or
over it?
precisely
but just thinking the s/and
with an unspec in implicitly also becomes an unspec
i.e. its contagious like a type