MathGroup Archive 1999

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

Search the Archive

Early out with Map?

  • To: mathgroup at
  • Subject: [mg16036] Early out with Map?
  • From: "Oscar Stiffelman" <ostiffel at>
  • Date: Sat, 20 Feb 1999 02:52:15 -0500
  • Organization: SBC Internet Services
  • Sender: owner-wri-mathgroup at


Is it possible to interrupt Map before it reaches then end of the list?

For example, how would I convert the following from procedural to

(* This is the procedural version *)
foundSolution = False;
For[i =1, i <= numChildren && ! foundSolution, i++,
        foundSolution = True;

* This keeps going until it reaches the end of the list.
* I would prefer to return as soon as testChild returns True
Or @@ Map[testChild, children]

* This does not actually return
Map[If[testChild[#], Return[True], False]&, children]

  • Prev by Date: Re: Strange result of Limit function in Mathematica3.0
  • Next by Date: Graphics over mathlink.
  • Previous by thread: fonts and mathematica/publicon
  • Next by thread: Re: Early out with Map?