MathGroup Archive 2004

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

Search the Archive

Re: NestList

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50554] Re: NestList
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 10 Sep 2004 04:05:52 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <chpa26$jt6$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

simple:

i = 1;
NestList[(Print[i++]; f[#]) &, {1, 2, 3, 4}, 4]


or more elegant with Th. Grays ShowStatus[]

ShowStatus[status_] := 
  LinkWrite[$ParentLink, 
    SetNotebookStatusLine[FrontEnd`EvaluationNotebook[],
ToString[status]]]

i = 1;
NestList[(ShowStatus[i++]; f[#]) &, {1, 2, 3, 4}, 4]

Regards
  Jens

Namrata Khemka wrote:
> 
> Hello everyone,
> 
> I have a question regarding NestList function.
> 
> I am applying a function on the expression n times.
> 
> NestList [function, expr, n]
> 
> However in my function I would like to know what is the current value
> of n. In other words I would like to know what iteration it is on.
> 
> Is this possible?
> 
> Thanks in advance.
> 
> Namrata Khemka


  • Prev by Date: Re: ColorFunctions again (making z=0 be different from z=1)
  • Next by Date: Re: NestList
  • Previous by thread: NestList
  • Next by thread: Re: NestList