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: A Reap Sow question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65198] Re: A Reap Sow question
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 17 Mar 2006 05:45:38 -0500 (EST)
  • References: <dvdif7$a2p$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Janos,
there is something wrong with your questions. See below.
Daniel

János wrote:
> Hi,
> 
> First, thanks a lot to Valeri Astanoff, Daniel Lichtblau, David Park  
> and Carl Woll  for the valuable suggestions to my previous post.
> 
> Let say I have a construct like
> 
> collection=Reap[i=1; While[i<=10,Sow[i]];]
No real problem here, but you certainly want to increment i, otherwise 
you get an infinit loop.
> 
> Is it possible to put a condition on Sow referring back to  
> collection ?  Something like:
> 
> collection=Reap[i=1; While[i<=10,If[Length[First[Last[collection]] ] 
>  >5,,Sow[i] ] ];]
Sure, but we have a real problem here.

Before you execute your statement, collection has no value. Even during 
execution of the right side, collection has no yet a value. Therefore, 
what do you want to test?

You could set collection to some value before execution of your 
statement. Your test would then apply to this value. Note also, if you 
execute the statement repeatetly, the test always concerns the previous 
value of collection.

> 
> If not, - I have not seen any indication in Help either way - , what  
> technique can be used to get a similar effect without resorting to  
> global lists or arrays?
> 
> Thanks ahead,
> 
> János
> 
> 
> ------------------------------------------------------
> I am seriously convinced that the world is ruled by complete  
> lunatics. The ones who are not crazy are either refraining from it,  
> or are unable to participate in it.  <Leo Tolstoy>
> 


  • Prev by Date: Re: Subscripted variables and function definitions
  • Next by Date: Re: variance of difference sign test
  • Previous by thread: Re: A Reap Sow question
  • Next by thread: Re: A Reap Sow question