Re: How to use only part of mapping
- To: mathgroup at smc.vnet.net
- Subject: [mg57276] Re: How to use only part of mapping
- From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
- Date: Mon, 23 May 2005 02:20:45 -0400 (EDT)
- Organization: Uni Leipzig
- References: <d6p1qa$iei$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Catch[ If[# > 5, Throw[#], Print[#]; #]] & /@ Range[10] ??? Regards Jens "Guy Israeli" <guyi1 at netvision.net.il> schrieb im Newsbeitrag news:d6p1qa$iei$1 at smc.vnet.net... > Hi, > > I want to do some mapping (/@) related > operations since I don't want to use > for/while loops because of all the index mayhem. > > The problem is that I don't need the map > operation to continue once some > condition is met. > > Is there a way to stop the mapping operation so > it will not continue, thus > saving valuable calculation time (since there is > no need to continue). > > for example (not useful though) > > Print[#]&/@Range[10] > and stop printing if #>5 > > > If it isn't possible to do it with map, what are > my other options? > > Thanks, > > Guy > >