On Oct 22, 10:59 am, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On 22 Okt., 07:48, Shantanu Kumar <kumar.shant...@gmail.com> wrote:
>
> > When I runs this using Clojure 1.2.0:
>
> > (binding [*assert* false] (assert false))
>
> > I get
>
> > java.lang.AssertionError: Assert failed: false
>
> > Can somebody please help me understand how to use *assert* for
> > conditional assertions?
>
> The assert above will be expanded when the binding form is compiled.
> Since *assert* during expansion time it cannot see the binding. Put
> the assert in a file and try something like (binding [*assert* false]
> (load-file "the-file.clj")). Then you should see the desired
> behaviour.

Thanks Meikel, I realized this also seems to work:

(binding [*assert* false]
  (if *assert*
    (assert foo)))

Regards,
Shantanu

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to