Re: compound conditions (and/or)

2010-03-23 Thread Michael Teter
Excellent, exactly the information I was seeking.

Thanks much!

On Mar 23, 4:18 am, Meikel Brandmeyer  wrote:
> Hi,
>
> On Mar 23, 10:09 am, Michael Teter  wrote:
>
> > Is it possible to do a compound condition, such as "if this test AND
> > that test"?
>
> (if (and (this test) (that test))
>   ...
>   ...)
>
> or is left as an exercise. ;)
>
> > For example, if 0 <= x <= 10.  I realize there may be a proper Clojure
> > idiom for that, so please enlighten me as well.
>
> This special case can be handled via <= itself:
>
> (if (<= 0 x 10)
>   ...
>   ...)
>
> Hope this helps.
>
> Sincerely
> Meikel

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: compound conditions (and/or)

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Mar 23, 10:09 am, Michael Teter  wrote:

> Is it possible to do a compound condition, such as "if this test AND
> that test"?

(if (and (this test) (that test))
  ...
  ...)

or is left as an exercise. ;)

> For example, if 0 <= x <= 10.  I realize there may be a proper Clojure
> idiom for that, so please enlighten me as well.

This special case can be handled via <= itself:

(if (<= 0 x 10)
  ...
  ...)

Hope this helps.

Sincerely
Meikel

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.