This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-18
Channels
- # aleph (12)
- # beginners (31)
- # boot (67)
- # cider (17)
- # cljs-dev (14)
- # clojure (111)
- # clojure-dev (1)
- # clojure-france (4)
- # clojure-gamedev (1)
- # clojure-italy (49)
- # clojure-nl (3)
- # clojure-poland (2)
- # clojure-russia (18)
- # clojure-spec (15)
- # clojure-uk (68)
- # clojurescript (33)
- # core-typed (1)
- # datomic (15)
- # emacs (3)
- # graphql (4)
- # hoplon (36)
- # leiningen (3)
- # lumo (44)
- # mount (2)
- # off-topic (46)
- # om (21)
- # onyx (47)
- # parinfer (22)
- # pedestal (21)
- # protorepl (4)
- # quil (4)
- # re-frame (15)
- # reagent (4)
- # ring-swagger (9)
- # rum (27)
- # spacemacs (11)
- # vim (7)
- # yada (8)
is there any way to “merge” two map generators?
well, I don’t have specs for the maps I need to merge (so it’s not strictly a spec question!)
(gen/let {m1 gen-m1, m2 gen-m2} (merge m1 m2))
oh there’s gen/let!
that’s great, thanks @gfredericks!
hello everyone, how can i validate a month inside a string? is the regexp approach the best? it should be a string containing 2 digits ranging from “01” to “12"
it's certainly easy as a regex #"0[1-9]|1[0-2]"
(into #{} (map #(format "%02d" %)) (range 1 13))
You could build a set of the strings as the count is small too. 🙂Then with clojure.spec you can do something like (s/def ::month-number-str (into #{} (map #(format "%02d" %)) (range 1 13)))
.
And/or just write it out like so:
(s/def month-number-str
#{"01" "02" "03" ...}
I'd like to generate a spec dynamically, where the name of the spec is returned from a function. Is there any prior art on this?