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