This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-11
Channels
- # beginners (132)
- # boot (2)
- # cider (17)
- # cljs-dev (6)
- # cljsrn (24)
- # clojure (134)
- # clojure-austin (2)
- # clojure-dusseldorf (11)
- # clojure-france (1)
- # clojure-greece (27)
- # clojure-italy (17)
- # clojure-madison (1)
- # clojure-russia (31)
- # clojure-serbia (1)
- # clojure-sg (2)
- # clojure-spec (30)
- # clojure-uk (66)
- # clojurescript (73)
- # core-async (2)
- # cursive (8)
- # data-science (2)
- # datomic (23)
- # dirac (8)
- # emacs (18)
- # gsoc (1)
- # hoplon (36)
- # immutant (26)
- # leiningen (6)
- # off-topic (21)
- # om (19)
- # onyx (6)
- # other-languages (1)
- # pedestal (3)
- # proton (2)
- # random (1)
- # re-frame (1)
- # reagent (2)
- # remote-jobs (2)
- # ring-swagger (8)
- # rum (21)
- # slack-help (1)
- # spacemacs (4)
- # specter (16)
- # untangled (6)
It appears as though the docs for set-validator!
are inaccurate. https://crossclj.info/ns/org.clojure/clojurescript/latest/cljs.core.cljs.html#_set-validator%21
If the current state
is not acceptable to the new validator, an Error will be thrown and the
validator will not be changed.
I'm working on a custom ref type right now, so I may end up with something fitting for a patch.
dev:user.ex=> (def s (atom 1))
#'user.ex/s
dev:user.ex=>
dev:user.ex=> (set-validator! s even?)
#object[cljs$core$even_QMARK_ "function cljs$core$even_QMARK_(n){
if(cljs.core.integer_QMARK_(n)){
return ((n & (1)) === (0));
} else {
throw (new Error([cljs.core.str.cljs$core$IFn$_invoke$arity$1("Argument must be an integer: "),cljs.core.str.cljs$core$IFn$_invoke$arity$1(n)].join('')));
}
}"]
No Error thrown.