This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-11
Channels
- # adventofcode (129)
- # architecture (10)
- # beginners (163)
- # boot (1)
- # cider (34)
- # cljs-dev (9)
- # clojure (210)
- # clojure-austin (11)
- # clojure-czech (2)
- # clojure-gamedev (1)
- # clojure-greece (67)
- # clojure-italy (2)
- # clojure-russia (8)
- # clojure-spec (36)
- # clojure-uk (54)
- # clojurescript (87)
- # cursive (12)
- # data-science (6)
- # datomic (13)
- # devcards (4)
- # editors (2)
- # emacs (34)
- # figwheel (6)
- # fulcro (147)
- # graphql (17)
- # lumo (54)
- # off-topic (37)
- # om (11)
- # onyx (7)
- # parinfer (10)
- # random (1)
- # re-frame (13)
- # ring (10)
- # ring-swagger (2)
- # sfcljs (1)
- # shadow-cljs (1)
- # spacemacs (32)
- # test-check (4)
- # unrepl (84)
It shouldn’t be if you load clojure.spec.alpha :as s
Docs also at https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha/merge
https://clojuredocs.org/clojure.spec/merge this is pretty bare
but you also have https://clojure.org/guides/spec#_entity_maps and its got s/merge inside of it too
@gfredericks @mpenet bumped into the need of bijections too: In routing, if a path-parameter is declared as keyword?
we can easily coerce it from string with string->keyword
. But with reverse-routing, we need to turn that keyword param back to string to create a path. I seem to have resolved that earlier by using a json-encoder to write things to string-like, but this can’t be the right way to do this.
I guess a simple (and fast) way would be to introduce a IntoString
Protocol. But I guess there can be N different formats to read from and same N formats to write to. Hmm.
Actually, I think I can just introduce a new type-conformer for spec-tools for the opposite direction type->string.
No, using the conform requires the end value to be valid. This would require something like the CLJ-2251 with a “just transform without validating” options. Or something totally different.
so would still be a good use case for a bijections library?
@gfredericks Would be best if spec itself provided the needed hooks to implement the bijections, but not likely to happen. I need something now, so will hack something. If you have good ideas how to do this properly, I’m all ears!
@alexmiller when will clojure.core/long?
be released? it is in master, but is not in clojure 1.9.0 as I expected (or am I missing something?). Thanks
https://dev.clojure.org/jira/browse/CLJ-1298
@misha see https://github.com/clojure/clojure/commit/20f67081b7654e44e960defb1e4e491c3a0c2c8b
is there out of the box generator for System.currentTimeMillis
?
(apart from clojure.test.check.impl/gen-current-time-millis)
@misha how is what you're describing different from generating a long?
they weren't far greater than 0 in 1970
they were negative in 1969
is there a (not clojure) spec for these numbers? I've never heard of one
anyhow, with time generators you have three options
A) make a generator that is not focused on your current now (cleanest if you can get away with it)
B) call (time/now)
somehow before constructing your generators and pass that in (lots of boilerplate potentially)
C) make a nondeterministic generators (with associated damage to reproducibility and shrinking)
for B) you'd want to log the time you're using, for reproducibility
thank you.
at this point I think I might just use int?
with s/with-gen
, and supply (System.currentTimeMillis)
as a generator, as my only goal (so far) with this particular value - is plausible human-readable exercise data.
converting to/from time-mills would be a cool savant mental trick
Is there a megathread somewhere about 1.9 discussions? Did spec get pulled from the release as a finished product? Are macros using spec in the stable release? what's going on?
spec got pulled out, it's still alpha but no major breaking API changes are expected, currently there's specs for ns
, let
, fn
, defn
Here’s the spec split announcement which explains: https://groups.google.com/forum/m/#!msg/clojure/10dbF7w2IQo/ec37TzP5AQAJ
Thanks @alexmiller, I'll bet that was a bummer of an internal conversation 😕