This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-12
Channels
- # beginners (2)
- # boot (1)
- # cider (3)
- # cljsrn (28)
- # clojure (70)
- # clojure-russia (1)
- # clojure-spec (21)
- # clojure-uk (2)
- # clojurescript (16)
- # component (10)
- # data-science (5)
- # datomic (9)
- # emacs (5)
- # fulcro (2)
- # jobs (1)
- # juxt (1)
- # klipse (23)
- # lumo (1)
- # mount (12)
- # off-topic (4)
- # parinfer (1)
- # re-frame (20)
- # ring-swagger (2)
- # spacemacs (4)
I’m trying to migrate a project from pre clojure.spec.alpha
to post-that, and I get this error:
Is it possible to remove all conforming on a spec so that it just returns identity
(but still does the validation)?
Sounds like the wrong solution to the pb. Maybe you need to decompose upstream spec(s) to build this kind of things
Yeah, I abandoned that approach. I'm trying to submit a patch for https://dev.clojure.org/jira/browse/CLJ-2199?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
Came to what I think is a better solution.
@danielstockton clojure.spec.alpha/nonconforming
(defn ^:skip-wiki nonconforming
"takes a spec and returns a spec that has the same properties except
'conform' returns the original (not the conformed) value. Note, will specize regex ops."
[spec]
As a note here, this was intentionally left out of the docs (the “skip-wiki” meta) because Rich is still mulling whether to include it. Some time has passed since we last talked about it, but at this point I think we should either keep it, or we should have a nonconforming version of s/or (which is the really common case where you want it).
@misha thanks!
hey, it’s me! :)
TIL, regular-expression specs work like splicing, so nested reg-ex specs expect flat data structure
tbh, it took me like flubbing this like 5 times before I really knew it
and I even wrote 2 implementations of it before the current one!