Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: "short circuiting" And and Or

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70635] Re: [mg70582] "short circuiting" And and Or
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Sat, 21 Oct 2006 05:14:53 -0400 (EDT)
  • References: <200610200921.FAA11062@smc.vnet.net>

condition /@ (And @@ list)

If the objects in your list will not react to being contained inside
an And, apply it first and then map the condition onto it.

Otherwise, use Catch, Scan, and Throw

On 10/20/06, Szabolcs Horvat <szhorvat at gmail.com> wrote:
> I'd like to write a function that tests whether there are any elements
> in a list that violate a certain condition. I could simply use
> And@@condition/@list, but for reasons of efficiency I'd like to stop
> the testing as soon as a "False" value is found. Is there any elegant
> way of doing this without writing an explicit While loop?
>
> Szabolcs Horvát
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: making random matrix
  • Next by Date: Re: "short circuiting" And and Or
  • Previous by thread: "short circuiting" And and Or
  • Next by thread: Re: "short circuiting" And and Or