This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-02
Channels
- # adventofcode (20)
- # bangalore-clj (14)
- # beginners (72)
- # cider (2)
- # clara (2)
- # cljs-dev (8)
- # clojure (36)
- # clojure-brasil (201)
- # clojure-greece (29)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-russia (2)
- # clojure-spec (5)
- # clojure-uk (4)
- # clojurescript (41)
- # cursive (1)
- # datomic (1)
- # emacs (6)
- # fulcro (80)
- # graphql (1)
- # klipse (2)
- # leiningen (5)
- # lumo (15)
- # off-topic (1)
- # om (3)
- # om-next (3)
- # re-frame (19)
- # reagent (7)
- # test-check (1)
- # uncomplicate (2)
- # yada (8)
I had an issue with a spec I defined in a .cljc file. I use an or to make one of two keys required. That’s working fine. But when I inspect the form in clj the or is without namespace, while I was expecting the namespace to be clojure.core.
What do you mean by “inspect”?
I debugged by adding logging. (namespace x) is empty in the .cljc one, but clojure.core when the spec is defined in a .clj file.
I still don’t understand a) what you’re doing b) what you’re seeing or c) what you expect to see
What I do is have a library which for a subset of what’s possible to spec, transform the namespaced data into a vector without namespaces in such a way that I’m able to get back to namespaced map from the vector. Part of this is checking the form of the spec used. When you use clojure.spec.alpha/keys, you can use clojure.core/or to be able to spec “one of these should be there”. Now when the spec id defined in a .clj file the or is namespaces eith clojure.core, but when the spec is defined in a .cljc file the or has no namespace. I now solved it by looking only at the name of the or symbol. So there is no real problem anymore, but I was surprised this was happening.