This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (107)
- # calva (2)
- # cider (1)
- # clara (1)
- # clj-kondo (17)
- # clojure (74)
- # clojure-europe (18)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (10)
- # conjure (12)
- # datomic (4)
- # figwheel-main (1)
- # fulcro (28)
- # graalvm (11)
- # hugsql (12)
- # joker (1)
- # klipse (5)
- # malli (2)
- # meander (1)
- # membrane (9)
- # off-topic (26)
- # pedestal (6)
- # remote-jobs (1)
- # ring-swagger (5)
- # shadow-cljs (4)
- # test-check (14)
- # vrac (8)
- # xtdb (8)
The fact that you’re destructuring the key doesn’t change the fact that budget-item-type
simply accepts a map. Assuming you have a spec for :transaction/amount
, your args spec would be something like
(s/cat (s/keys :req-un [:transaction/amount]))
@U6GFE9HS7 That's the answer they got in the other channel.
Please don't encourage people to cross-post questions here.
Oops, didn’t see that. Noted @seancorfield
@hadilsabbagh18 It's a good idea to not cross-post questions here.
You've already gotten a response in another channel on this.
@seancorfield Sorry my bad
How to constrain the size of two dependent coll-of specs, A & B so that (<= (count (concat A B)) 40)
? AFAICT, I need to use g/bind to constrain the :max-count
of B's sample based on the length of A, but I'm having some trouble getting this to work in Spec2.
@alexmiller you mentioned you are considering basic logic resolution. It would be awesome if it was possible to do something like:
(let [a (s/coll-of digit? :max-count 30)
b (s/coll-of digit? :max-count (- 40 (s/count a))]
(g/fmap (fn [a b] (apply str a ":" b) [(s/gen a) (s/gen b)]))
I always use gen/let
for this sort of thing. You can use it just like a normal let except with generators on the rhs and generated values bound to the lhs. if you need a regular value you can use a gen/return
to effectively raise them to that level such that both regular values and generated values can be bound in the same gen/let
.