Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: Why Return[] does not work?

  • To: mathgroup at
  • Subject: [mg109489] Re: Why Return[] does not work?
  • From: David Bailey <dave at>
  • Date: Thu, 29 Apr 2010 02:54:32 -0400 (EDT)
  • References: <hr6ihp$2f8$> <hr8isl$55h$> <hr94fk$e4c$>

Dims wrote:
> On 28 =D0=B0=D0=BF=D1=80, 09:59, "M.Roellig" <markus.roel... at>> wrote:
>> In[2]:= Intersection[{a, b}, {c, a}] =!= {}
> But would Mathematica optimize evaluation of this expression, i.e.,
> terminate searching for common elements if one already found?
It would not terminate searching early because the result was being 
compared with {}, but it would probably be more efficient anyway because:

a) It would sort the two lists to make the intersection process more 

b) There is an overhead to each Mathematica step, so that using a 
built-in operation is usually more efficient than coding your own - but 
if in doubt, you can always check using Timing. It is this overhead that 
makes functional operations more efficient, because they just take fewer 

David Bailey

  • Prev by Date: Re: NDSolve: ..numerically ill-conditioned...
  • Next by Date: Re: Sphere formula
  • Previous by thread: Re: Why Return[] does not work?
  • Next by thread: Re: Why Return[] does not work?