I was to understanding that Clojure's *assert*
variable could be used to turn off assertions, but nothing I do seems to works.
(defn foo [a]
{:pre [(pos? a)]}
(assert (even? a))
[a])
(binding [*assert* false]
(foo 1))
!! exception
(binding [*assert* false]
(foo -2))
!! exception
Even to binding false
when defining has same problems:
(binding [*assert* false]
(defn bar [a]
{:pre [(pos? a)]}
(assert (even? a))
[a]))
(bar 1)
!! execption
And then even to setting the variable direct does not working.
*assert*
is true
(alter-var-root (var *assert*) not)
*assert*
is still true
and
(var-set (var *assert*) false)
*assert*
is still true
So now I am not understanding what to do. I am confused.
Thank you.