This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-26
Channels
- # aleph (3)
- # beginners (98)
- # boot (24)
- # cljs-dev (13)
- # cljsrn (16)
- # clojure (97)
- # clojure-dusseldorf (2)
- # clojure-italy (2)
- # clojure-losangeles (2)
- # clojure-russia (48)
- # clojure-spec (28)
- # clojure-uk (79)
- # clojurescript (79)
- # community-development (2)
- # cursive (4)
- # datomic (35)
- # duct (1)
- # events (1)
- # fulcro (43)
- # heroku (1)
- # jobs (1)
- # lein-figwheel (2)
- # luminus (1)
- # lumo (12)
- # nyc (1)
- # off-topic (6)
- # om (1)
- # pedestal (7)
- # portkey (9)
- # proton (1)
- # re-frame (45)
- # reagent (27)
- # rum (2)
- # shadow-cljs (78)
- # spacemacs (3)
- # specter (2)
- # testing (2)
- # vim (41)
I want to generate strings of length 64. This code does the job, but seems a bit unwieldy. Is there a nicer way to do this?
(gen/generate (gen/fmap clojure.string/join
(gen/vector clojure.test.check.generators/char-ascii
64)))
if you like gen/let
better syntactically, you can
(gen/let [chars (gen/vector test.check.generators/char-ascii 64)]
(apply str chars))
modulo getting all the namespaces right
Something specialized for strings?
The whole string thing needs an overhaul if anybody can think of a reasonable approach to unicode
That is a good example of the issues. Try generating matches for #".*" and see how much you like it
I wish there was a way to mark a function as impure in an fdef/fspec that had the consequence of turning on :ret validation for instrumentation and turning off validation of things against that fspec
Hi all, is there a way in spec to define a map with something like this: (s/def ::my-map :req-un [::name ::id (one-of ::role ::title)]
?? ...So the data could be {:name "tom" :id "1" :role "mgr"}
or {:name "tom" :id "1" :title "ceo"}
for example. Thx!
it's been a while but what little is left of my Maths for CS class in my brain is saying you can't create an xor with just or and and. so I'd say you'd have to just use or + a predicate
well s/keys supports or, so (s/def ::my-map :req-un [::name ::id (or ::role ::title)]) is perfectly valid
my point was just that {:name "tom" :id "1" :role "mgr" :title "ceo"} would be valid with that spec (as would your two examples)
Hi, is there an automated way to get a spec for the output of conform, called with another given spec?
I mean:
> (def sp (s/cat :x double? :y double?))
> (s/conform sp [1.0 2.5])
{:x 1.0, :y 2.5} <- I'd like a spec describing this map
no, although that’s been asked a few times.